From c8d599189cdc204b745d25c49a43d6d1dc60928c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sat, 21 Jun 2014 03:18:21 +0200 Subject: [PATCH] FML Update --- .../core/Libs/FML/Components/CheckBox.php | 57 ++-- .../core/Libs/FML/Components/ValuePicker.php | 33 +- application/core/Libs/FML/Controls/Audio.php | 38 +-- .../core/Libs/FML/Controls/Control.php | 297 ++++++++++-------- application/core/Libs/FML/Controls/Entry.php | 64 ++-- .../core/Libs/FML/Controls/FileEntry.php | 32 +- application/core/Libs/FML/Controls/Frame.php | 26 +- .../core/Libs/FML/Controls/Frame3d.php | 41 +-- .../core/Libs/FML/Controls/FrameInstance.php | 59 ++-- application/core/Libs/FML/Controls/Gauge.php | 78 ++--- application/core/Libs/FML/Controls/Label.php | 107 +++---- .../Libs/FML/Controls/Labels/Label_Button.php | 22 +- .../Libs/FML/Controls/Labels/Label_Text.php | 22 +- application/core/Libs/FML/Controls/Quad.php | 101 +++--- .../Libs/FML/Controls/Quads/Quad_321Go.php | 36 +-- .../FML/Controls/Quads/Quad_BgRaceScore2.php | 82 ++--- .../Libs/FML/Controls/Quads/Quad_Bgs1.php | 160 +++++----- .../FML/Controls/Quads/Quad_Bgs1InRace.php | 160 +++++----- .../Quads/Quad_BgsChallengeMedals.php | 40 +-- .../FML/Controls/Quads/Quad_BgsPlayerCard.php | 56 ++-- .../Libs/FML/Controls/Quads/Quad_Copilot.php | 52 ++- .../Libs/FML/Controls/Quads/Quad_Emblems.php | 30 +- .../FML/Controls/Quads/Quad_EnergyBar.php | 40 +-- .../FML/Controls/Quads/Quad_Hud3dEchelons.php | 36 +-- .../FML/Controls/Quads/Quad_Hud3dIcons.php | 44 +-- .../Controls/Quads/Quad_Icons128x128_1.php | 24 +- .../Quads/Quad_Icons128x128_Blink.php | 24 +- .../FML/Controls/Quads/Quad_Icons128x32_1.php | 80 ++--- .../FML/Controls/Quads/Quad_Icons64x64_1.php | 198 ++++++------ .../FML/Controls/Quads/Quad_Icons64x64_2.php | 54 ++-- .../Controls/Quads/Quad_ManiaPlanetLogos.php | 24 +- .../Quads/Quad_ManiaPlanetMainMenu.php | 24 +- .../Controls/Quads/Quad_ManiaplanetSystem.php | 24 +- .../FML/Controls/Quads/Quad_MedalsBig.php | 24 +- .../FML/Controls/Quads/Quad_TitleLogos.php | 24 +- .../Quads/Quad_UIConstruction_Buttons.php | 24 +- .../Quads/Quad_UIConstruction_Buttons2.php | 24 +- .../Quads/Quad_UiSMSpectatorScoreBig.php | 24 +- application/core/Libs/FML/Controls/Video.php | 38 +-- application/core/Libs/FML/CustomUI.php | 81 +++-- application/core/Libs/FML/Elements/Dico.php | 89 +++--- application/core/Libs/FML/Elements/Format.php | 23 +- .../core/Libs/FML/Elements/FrameModel.php | 27 +- .../core/Libs/FML/Elements/Including.php | 25 +- application/core/Libs/FML/Elements/Music.php | 25 +- .../core/Libs/FML/Elements/SimpleScript.php | 27 +- application/core/Libs/FML/ManiaCode.php | 167 +++++----- .../core/Libs/FML/ManiaCode/AddBuddy.php | 34 +- .../core/Libs/FML/ManiaCode/AddFavorite.php | 65 ++-- .../core/Libs/FML/ManiaCode/Element.php | 6 +- .../core/Libs/FML/ManiaCode/GetSkin.php | 68 ++-- application/core/Libs/FML/ManiaCode/Go_To.php | 36 +-- .../Libs/FML/ManiaCode/InstallMacroblock.php | 66 ++-- .../core/Libs/FML/ManiaCode/InstallMap.php | 41 ++- .../core/Libs/FML/ManiaCode/InstallPack.php | 55 ++-- .../core/Libs/FML/ManiaCode/InstallReplay.php | 41 ++- .../core/Libs/FML/ManiaCode/InstallScript.php | 55 ++-- .../core/Libs/FML/ManiaCode/InstallSkin.php | 55 ++-- .../core/Libs/FML/ManiaCode/JoinServer.php | 57 ++-- .../core/Libs/FML/ManiaCode/PlayMap.php | 41 ++- .../core/Libs/FML/ManiaCode/PlayReplay.php | 41 ++- .../core/Libs/FML/ManiaCode/ShowMessage.php | 25 +- .../core/Libs/FML/ManiaCode/ViewReplay.php | 41 ++- application/core/Libs/FML/ManiaLink.php | 109 ++++--- application/core/Libs/FML/ManiaLinks.php | 45 ++- .../core/Libs/FML/Models/CheckBoxDesign.php | 43 ++- application/core/Libs/FML/Script/Builder.php | 59 ++-- .../FML/Script/Features/ActionTrigger.php | 48 +-- .../FML/Script/Features/CheckBoxFeature.php | 88 +++--- .../core/Libs/FML/Script/Features/Clock.php | 35 ++- .../FML/Script/Features/ControlScript.php | 43 +-- .../Libs/FML/Script/Features/EntrySubmit.php | 34 +- .../Libs/FML/Script/Features/KeyAction.php | 81 ++--- .../core/Libs/FML/Script/Features/MapInfo.php | 22 +- .../core/Libs/FML/Script/Features/Menu.php | 34 +- .../Libs/FML/Script/Features/MenuElement.php | 23 +- .../core/Libs/FML/Script/Features/Paging.php | 126 ++++---- .../Libs/FML/Script/Features/PagingButton.php | 23 +- .../Libs/FML/Script/Features/PagingPage.php | 20 +- .../FML/Script/Features/PlayerProfile.php | 40 +-- .../FML/Script/Features/ScriptFeature.php | 14 +- .../core/Libs/FML/Script/Features/Toggle.php | 59 ++-- .../core/Libs/FML/Script/Features/Tooltip.php | 68 ++-- .../core/Libs/FML/Script/Features/UISound.php | 50 +-- .../Script/Features/ValuePickerFeature.php | 104 +++--- application/core/Libs/FML/Script/Script.php | 81 ++--- .../core/Libs/FML/Script/ScriptConstant.php | 25 +- .../core/Libs/FML/Script/ScriptFunction.php | 20 +- .../core/Libs/FML/Script/ScriptInclude.php | 25 +- .../core/Libs/FML/Script/ScriptLabel.php | 44 ++- application/core/Libs/FML/Stylesheet/Mood.php | 194 +++++------- .../core/Libs/FML/Stylesheet/Style3d.php | 119 +++---- .../core/Libs/FML/Stylesheet/Stylesheet.php | 41 +-- .../core/Libs/FML/Types/Actionable.php | 56 ++-- .../core/Libs/FML/Types/BgColorable.php | 12 +- application/core/Libs/FML/Types/Container.php | 22 +- application/core/Libs/FML/Types/Linkable.php | 26 +- .../core/Libs/FML/Types/NewLineable.php | 8 +- application/core/Libs/FML/Types/Playable.php | 34 +- .../core/Libs/FML/Types/Renderable.php | 4 +- .../core/Libs/FML/Types/ScriptFeatureable.php | 4 +- .../core/Libs/FML/Types/Scriptable.php | 8 +- application/core/Libs/FML/Types/Styleable.php | 8 +- .../core/Libs/FML/Types/SubStyleable.php | 16 +- .../core/Libs/FML/Types/TextFormatable.php | 26 +- application/core/Libs/FML/UniqueID.php | 71 +++++ application/core/Libs/FML/autoload.php | 57 +--- 107 files changed, 2484 insertions(+), 3099 deletions(-) create mode 100644 application/core/Libs/FML/UniqueID.php diff --git a/application/core/Libs/FML/Components/CheckBox.php b/application/core/Libs/FML/Components/CheckBox.php index 8f01ac1f..e48c6742 100644 --- a/application/core/Libs/FML/Components/CheckBox.php +++ b/application/core/Libs/FML/Components/CheckBox.php @@ -20,7 +20,7 @@ use FML\Types\ScriptFeatureable; */ class CheckBox implements Renderable, ScriptFeatureable { /* - * Protected Properties + * Protected properties */ protected $name = null; protected $feature = null; @@ -28,9 +28,9 @@ class CheckBox implements Renderable, ScriptFeatureable { /** * Create a new CheckBox Component * - * @param string $name (optional) CheckBox Name - * @param bool $default (optional) Default Value - * @param Quad $quad (optional) CheckBox Quad + * @param string $name (optional) CheckBox name + * @param bool $default (optional) Default value + * @param Quad $quad (optional) CheckBox quad */ public function __construct($name = null, $default = null, Quad $quad = null) { $this->feature = new CheckBoxFeature(); @@ -40,10 +40,10 @@ class CheckBox implements Renderable, ScriptFeatureable { } /** - * Set the Name + * Set the name * - * @param string $name CheckBox Name - * @return \FML\Components\CheckBox + * @param string $name CheckBox name + * @return \FML\Components\CheckBox|static */ public function setName($name) { $this->name = (string)$name; @@ -51,10 +51,10 @@ class CheckBox implements Renderable, ScriptFeatureable { } /** - * Set the Default Value + * Set the default value * - * @param bool $default Default Value - * @return \FML\Components\CheckBox + * @param bool $default Default value + * @return \FML\Components\CheckBox|static */ public function setDefault($default) { $this->feature->setDefault($default); @@ -62,28 +62,36 @@ class CheckBox implements Renderable, ScriptFeatureable { } /** - * Set the Enabled Design + * Set the enabled Design * - * @param string $style Style Name or Image Url - * @param string $subStyle SubStyle Name - * @return \FML\Components\CheckBox + * @param string $style Style name or image url + * @param string $subStyle SubStyle name + * @return \FML\Components\CheckBox|static */ public function setEnabledDesign($style, $subStyle = null) { - $checkBoxDesign = new CheckBoxDesign($style, $subStyle); - $this->feature->setEnabledDesign($checkBoxDesign); + if (is_object($style) && ($style instanceof CheckBoxDesign)) { + $this->feature->setEnabledDesign($style); + } else { + $checkBoxDesign = new CheckBoxDesign($style, $subStyle); + $this->feature->setEnabledDesign($checkBoxDesign); + } return $this; } /** - * Set the Disabled Design + * Set the disabled Design * - * @param string $style Style Name or Image Url - * @param string $subStyle SubStyle Name - * @return \FML\Components\CheckBox + * @param string $style Style name or image url + * @param string $subStyle SubStyle name + * @return \FML\Components\CheckBox|static */ public function setDisabledDesign($style, $subStyle = null) { - $checkBoxDesign = new CheckBoxDesign($style, $subStyle); - $this->feature->setDisabledDesign($checkBoxDesign); + if (is_object($style) && ($style instanceof CheckBoxDesign)) { + $this->feature->setDisabledDesign($style); + } else { + $checkBoxDesign = new CheckBoxDesign($style, $subStyle); + $this->feature->setDisabledDesign($checkBoxDesign); + } return $this; } @@ -91,7 +99,7 @@ class CheckBox implements Renderable, ScriptFeatureable { * Set the CheckBox Quad * * @param Quad $quad CheckBox Quad - * @return \FML\Components\CheckBox + * @return \FML\Components\CheckBox|static */ public function setQuad(Quad $quad = null) { $this->feature->setQuad($quad); @@ -143,8 +151,7 @@ class CheckBox implements Renderable, ScriptFeatureable { */ protected function buildEntry() { $entry = new Entry(); - $entry->setVisible(false); - $entry->setName($this->name); + $entry->setVisible(false)->setName($this->name); return $entry; } } diff --git a/application/core/Libs/FML/Components/ValuePicker.php b/application/core/Libs/FML/Components/ValuePicker.php index f650e004..a7f8e240 100644 --- a/application/core/Libs/FML/Components/ValuePicker.php +++ b/application/core/Libs/FML/Components/ValuePicker.php @@ -19,7 +19,7 @@ use FML\Types\ScriptFeatureable; */ class ValuePicker implements Renderable, ScriptFeatureable { /* - * Protected Properties + * Protected properties */ protected $name = null; protected $feature = null; @@ -27,10 +27,10 @@ class ValuePicker implements Renderable, ScriptFeatureable { /** * Create a new ValuePicker Component * - * @param string $name (optional) CheckBox Name - * @param array $values (optional) Possible Values - * @param bool $default (optional) Default Value - * @param Label $label (optional) ValuePicker Label + * @param string $name (optional) CheckBox name + * @param array $values (optional) Possible values + * @param bool $default (optional) Default value + * @param Label $label (optional) ValuePicker label */ public function __construct($name = null, array $values = array(), $default = null, Label $label = null) { $this->feature = new ValuePickerFeature(); @@ -41,10 +41,10 @@ class ValuePicker implements Renderable, ScriptFeatureable { } /** - * Set the Name + * Set Name * - * @param string $name ValuePicker Name - * @return \FML\Components\ValuePicker + * @param string $name ValuePicker name + * @return \FML\Components\ValuePicker|static */ public function setName($name) { $this->name = (string)$name; @@ -52,10 +52,10 @@ class ValuePicker implements Renderable, ScriptFeatureable { } /** - * Set the possible Values + * Set the possible values * - * @param array $values Possible Values - * @return \FML\Components\ValuePicker + * @param array $values Possible values + * @return \FML\Components\ValuePicker|static */ public function setValues(array $values) { $this->feature->setValues($values); @@ -63,10 +63,10 @@ class ValuePicker implements Renderable, ScriptFeatureable { } /** - * Set the Default Value + * Set the default value * - * @param bool $default Default Value - * @return \FML\Components\ValuePicker + * @param bool $default Default value + * @return \FML\Components\ValuePicker|static */ public function setDefault($default) { $this->feature->setDefault($default); @@ -77,7 +77,7 @@ class ValuePicker implements Renderable, ScriptFeatureable { * Set the ValuePicker Label * * @param Label $label ValuePicker Label - * @return \FML\Components\ValuePicker + * @return \FML\Components\ValuePicker|static */ public function setLabel(Label $label = null) { $this->feature->setLabel($label); @@ -128,8 +128,7 @@ class ValuePicker implements Renderable, ScriptFeatureable { */ protected function buildEntry() { $entry = new Entry(); - $entry->setVisible(false); - $entry->setName($this->name); + $entry->setVisible(false)->setName($this->name); return $entry; } } diff --git a/application/core/Libs/FML/Controls/Audio.php b/application/core/Libs/FML/Controls/Audio.php index 768c5b03..d640709e 100644 --- a/application/core/Libs/FML/Controls/Audio.php +++ b/application/core/Libs/FML/Controls/Audio.php @@ -15,36 +15,16 @@ use FML\Types\Scriptable; */ class Audio extends Control implements Playable, Scriptable { /* - * Protected Properties + * Protected properties */ - protected $data = ''; - protected $dataId = ''; - protected $play = 0; - protected $looping = 0; - protected $music = 0; + protected $tagName = 'audio'; + protected $data = null; + protected $dataId = null; + protected $play = null; + protected $looping = true; + protected $music = null; protected $volume = 1.; - protected $scriptEvents = 0; - - /** - * Construct a new Audio Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->tagName = 'audio'; - } - - /** - * Create a new Audio Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Audio - */ - public static function create($id = null) { - $audio = new Audio($id); - return $audio; - } + protected $scriptEvents = null; /** * @see \FML\Controls\Control::getManiaScriptClass() @@ -110,7 +90,7 @@ class Audio extends Control implements Playable, Scriptable { } /** - * @see \FML\Control::render() + * @see \FML\Types\Renderable::render() */ public function render(\DOMDocument $domDocument) { $xmlElement = parent::render($domDocument); diff --git a/application/core/Libs/FML/Controls/Control.php b/application/core/Libs/FML/Controls/Control.php index 385899e4..2d4003fc 100644 --- a/application/core/Libs/FML/Controls/Control.php +++ b/application/core/Libs/FML/Controls/Control.php @@ -14,6 +14,7 @@ use FML\Script\Features\UISound; use FML\Script\ScriptLabel; use FML\Types\Renderable; use FML\Types\ScriptFeatureable; +use FML\UniqueID; /** * Base Control @@ -35,48 +36,55 @@ abstract class Control implements Renderable, ScriptFeatureable { const LEFT = 'left'; /* - * Static Properties - */ - protected static $currentIndex = 0; - - /* - * Protected Properties + * Protected properties */ protected $tagName = 'control'; - protected $id = ''; - protected $x = 0.; - protected $y = 0.; - protected $z = 0.; + protected $controlId = null; + protected $posX = 0.; + protected $posY = 0.; + protected $posZ = 0.; protected $width = -1.; protected $height = -1.; protected $hAlign = self::CENTER; protected $vAlign = self::CENTER2; protected $scale = 1.; - protected $hidden = 0; + protected $hidden = null; + protected $rotation = 0.; + /** @var string[] $classes */ protected $classes = array(); + /** @var ScriptFeature[] $scriptFeatures */ protected $scriptFeatures = array(); /** - * Construct a new Control + * Create a new Control object * - * @param string $id (optional) Control Id + * @param string $controlId (optional) Control id + * @return \FML\Controls\Control|static */ - public function __construct($id = null) { - if ($id !== null) { - $this->setId($id); + public static function create($controlId = null) { + return new static($controlId); + } + + /** + * Construct a new Control object + * + * @param string $controlId (optional) Control id + */ + public function __construct($controlId = null) { + if (!is_null($controlId)) { + $this->setId($controlId); } } /** - * Check Id for dangerous Characters and assign a unique Id if necessary + * Check Id for dangerous characters and assign a new unique id if necessary * - * @param bool $forceNewId Whether to force setting a newly generated Id - * @return \FML\Controls\Control + * @param bool $forceNewId (optional) Whether to force setting a newly generated id + * @return \FML\Controls\Control|static */ public function checkId($forceNewId = false) { if ($forceNewId || !$this->getId()) { - $this->setId('FML_ID_' . self::$currentIndex); - self::$currentIndex++; + $this->setId(new UniqueID()); return $this; } $dangerousCharacters = array(' ', ' ', '.', '|', '-', PHP_EOL); @@ -90,93 +98,94 @@ abstract class Control implements Renderable, ScriptFeatureable { break; } if ($danger) { - trigger_error("Please don't use special Characters in Ids, they might cause Problems! (I stripped them for You.)"); - $id = str_ireplace($dangerousCharacters, '', $this->getId()); - $this->setId($id); + trigger_error("Please don't use special characters in ids, they might cause problems! (I stripped them for you.)"); + $controlId = str_ireplace($dangerousCharacters, '', $this->getId()); + $this->setId($controlId); } return $this; } /** - * Get Control Id + * Get the Control id * - * @param bool $escaped (optional) Whether the Id should be escaped for ManiaScript + * @param bool $escaped (optional) Whether the id should be escaped for ManiaScript + * @param bool $addApostrophes (optional) Whether to add apostrophes before and after the text * @return string */ - public function getId($escaped = false) { + public function getId($escaped = false, $addApostrophes = false) { if ($escaped) { - return Builder::escapeText($this->id); + return Builder::escapeText($this->controlId, $addApostrophes); } - return $this->id; + return $this->controlId; } /** - * Set Control Id + * Set Control id * - * @param string $id Control Id - * @return \FML\Controls\Control + * @param string $controlId Control id + * @return \FML\Controls\Control|static */ - public function setId($id) { - $this->id = (string)$id; + public function setId($controlId) { + $this->controlId = (string)$controlId; return $this; } /** - * Set Control Position + * Set Control position * - * @param float $x Horizontal Position - * @param float $y Vertical Position - * @param float $z (optional) Depth - * @return \FML\Controls\Control + * @param float $posX Horizontal position + * @param float $posY Vertical position + * @param float $posZ (optional) Depth + * @return \FML\Controls\Control|static */ - public function setPosition($x, $y, $z = null) { - $this->setX($x); - $this->setY($y); - if ($z !== null) { - $this->setZ($z); + public function setPosition($posX, $posY, $posZ = null) { + $this->setX($posX); + $this->setY($posY); + if (!is_null($posZ)) { + $this->setZ($posZ); } return $this; } /** - * Set X Position + * Set X position * - * @param float $x Horizontal Position - * @return \FML\Controls\Control + * @param float $posX Horizontal position + * @return \FML\Controls\Control|static */ - public function setX($x) { - $this->x = (float)$x; + public function setX($posX) { + $this->posX = (float)$posX; return $this; } /** - * Set Y Position + * Set Y position * - * @param float $y Vertical Position - * @return \FML\Controls\Control + * @param float $posY Vertical position + * @return \FML\Controls\Control|static */ - public function setY($y) { - $this->y = (float)$y; + public function setY($posY) { + $this->posY = (float)$posY; return $this; } /** - * Set Z Position + * Set Z position * - * @param float $z Depth - * @return \FML\Controls\Control + * @param float $posZ Depth + * @return \FML\Controls\Control|static */ - public function setZ($z) { - $this->z = (float)$z; + public function setZ($posZ) { + $this->posZ = (float)$posZ; return $this; } /** - * Set Control Size + * Set Control size * - * @param float $width Control Width - * @param float $height Control Height - * @return \FML\Controls\Control + * @param float $width Control width + * @param float $height Control height + * @return \FML\Controls\Control|static */ public function setSize($width, $height) { $this->setWidth($width); @@ -185,10 +194,10 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Set Control Width + * Set Control width * - * @param float $width Control Width - * @return \FML\Controls\Control + * @param float $width Control width + * @return \FML\Controls\Control|static */ public function setWidth($width) { $this->width = (float)$width; @@ -196,10 +205,10 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Set Control Height + * Set Control height * - * @param float $height Control Height - * @return \FML\Controls\Control + * @param float $height Control height + * @return \FML\Controls\Control|static */ public function setHeight($height) { $this->height = (float)$height; @@ -207,9 +216,9 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Center Alignment + * Center alignment * - * @return \FML\Controls\Control + * @return \FML\Controls\Control|static */ public function centerAlign() { $this->setAlign(self::CENTER, self::CENTER2); @@ -217,11 +226,11 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Set Horizontal and Vertical Alignment + * Set horizontal and vertical alignment * - * @param string $hAlign Horizontal Alignment - * @param string $vAlign Vertical Alignment - * @return \FML\Controls\Control + * @param string $hAlign Horizontal alignment + * @param string $vAlign Vertical alignment + * @return \FML\Controls\Control|static */ public function setAlign($hAlign, $vAlign) { $this->setHAlign($hAlign); @@ -230,10 +239,10 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Set Horizontal Alignment + * Set horizontal alignment * - * @param string $hAlign Horizontal Alignment - * @return \FML\Controls\Control + * @param string $hAlign Horizontal alignment + * @return \FML\Controls\Control|static */ public function setHAlign($hAlign) { $this->hAlign = (string)$hAlign; @@ -241,10 +250,10 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Set Vertical Alignment + * Set vertical alignment * - * @param string $vAlign Vertical Alignment - * @return \FML\Controls\Control + * @param string $vAlign Vertical alignment + * @return \FML\Controls\Control|static */ public function setVAlign($vAlign) { $this->vAlign = (string)$vAlign; @@ -252,9 +261,9 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Reset Alignment + * Reset alignment * - * @return \FML\Controls\Control + * @return \FML\Controls\Control|static */ public function resetAlign() { $this->setAlign(null, null); @@ -262,10 +271,10 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Set Control Scale + * Set Control scale * - * @param float $scale Control Scale - * @return \FML\Controls\Control + * @param float $scale Control scale + * @return \FML\Controls\Control|static */ public function setScale($scale) { $this->scale = (float)$scale; @@ -273,10 +282,10 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Set Visibility + * Set visibility * - * @param bool $visible Whether Control should be visible - * @return \FML\Controls\Control + * @param bool $visible Whether the Control should be visible + * @return \FML\Controls\Control|static */ public function setVisible($visible = true) { $this->hidden = ($visible ? 0 : 1); @@ -284,10 +293,21 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Add new Class Name + * Set Control rotation * - * @param string $class Class Name - * @return \FML\Controls\Control + * @param float $rotation + * @return \FML\Controls\Control|static + */ + public function setRotation($rotation) { + $this->rotation = (float)$rotation; + return $this; + } + + /** + * Add a new class name + * + * @param string $class Class name + * @return \FML\Controls\Control|static */ public function addClass($class) { $class = (string)$class; @@ -301,31 +321,37 @@ abstract class Control implements Renderable, ScriptFeatureable { * Add a dynamic Action Trigger * * @param string $actionName Action to trigger - * @param string $eventLabel (optional) Event on which the Action is triggered - * @return \FML\Controls\Control + * @param string $eventLabel (optional) Event on which the action is triggered + * @return \FML\Controls\Control|static */ public function addActionTriggerFeature($actionName, $eventLabel = ScriptLabel::MOUSECLICK) { - $actionTrigger = new ActionTrigger($actionName, $this, $eventLabel); - $this->addScriptFeature($actionTrigger); + if (is_object($actionName) && ($actionName instanceof ActionTrigger)) { + $this->addScriptFeature($actionName); + } else { + $actionTrigger = new ActionTrigger($actionName, $this, $eventLabel); + $this->addScriptFeature($actionTrigger); + } return $this; } /** - * Add a Script Feature + * Add a new Script Feature * * @param ScriptFeature $scriptFeature Script Feature - * @return \FML\Controls\Control + * @return \FML\Controls\Control|static */ public function addScriptFeature(ScriptFeature $scriptFeature) { - array_push($this->scriptFeatures, $scriptFeature); + if (!in_array($scriptFeature, $this->scriptFeatures, true)) { + array_push($this->scriptFeatures, $scriptFeature); + } return $this; } /** - * Add a dynamic Feature opening the current Map Info + * Add a dynamic Feature opening the current map info * - * @param string $eventLabel (optional) Event on which the Map Info will be opened - * @return \FML\Controls\Control + * @param string $eventLabel (optional) Event on which the map info will be opened + * @return \FML\Controls\Control|static */ public function addMapInfoFeature($eventLabel = ScriptLabel::MOUSECLICK) { $mapInfo = new MapInfo($this, $eventLabel); @@ -334,11 +360,11 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Add a dynamic Feature to open a specific Player Profile + * Add a dynamic Feature to open a specific player profile * - * @param string $login The Login of the Player - * @param string $eventLabel (optional) Event on which the Player Profile will be opened - * @return \FML\Controls\Control + * @param string $login Login of the player + * @param string $eventLabel (optional) Event on which the player profile will be opened + * @return \FML\Controls\Control|static */ public function addPlayerProfileFeature($login, $eventLabel = ScriptLabel::MOUSECLICK) { $playerProfile = new PlayerProfile($login, $this, $eventLabel); @@ -347,12 +373,12 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Add a dynamic Feature playing an UISound + * Add a dynamic Feature playing a UISound * - * @param string $soundName UISound Name - * @param int $variant (optional) Sound Variant - * @param string $eventLabel (optional) Event on which the Sound will be played - * @return \FML\Controls\Control + * @param string $soundName UISound name + * @param int $variant (optional) Sound variant + * @param string $eventLabel (optional) Event on which the sound will be played + * @return \FML\Controls\Control|static */ public function addUISoundFeature($soundName, $variant = 0, $eventLabel = ScriptLabel::MOUSECLICK) { $uiSound = new UISound($soundName, $this, $variant, $eventLabel); @@ -364,10 +390,10 @@ abstract class Control implements Renderable, ScriptFeatureable { * Add a dynamic Feature toggling another Control * * @param Control $toggledControl Toggled Control - * @param string $labelName (optional) Script Label Name - * @param bool $onlyShow (optional) Whether it should only Show the Control but not toggle - * @param bool $onlyHide (optional) Whether it should only Hide the Control but not toggle - * @return \FML\Controls\Control + * @param string $labelName (optional) Script label name + * @param bool $onlyShow (optional) Whether it should only show the Control but not toggle + * @param bool $onlyHide (optional) Whether it should only hide the Control but not toggle + * @return \FML\Controls\Control|static */ public function addToggleFeature(Control $toggledControl, $labelName = Scriptlabel::MOUSECLICK, $onlyShow = false, $onlyHide = false) { $toggle = new Toggle($this, $toggledControl, $labelName, $onlyShow, $onlyHide); @@ -379,9 +405,9 @@ abstract class Control implements Renderable, ScriptFeatureable { * Add a dynamic Feature showing a Tooltip on hovering * * @param Control $tooltipControl Tooltip Control - * @param bool $stayOnClick (optional) Whether the Tooltip should stay on Click - * @param bool $invert (optional) Whether the Visibility Toggling should be inverted - * @return \FML\Controls\Control + * @param bool $stayOnClick (optional) Whether the Tooltip should stay on click + * @param bool $invert (optional) Whether the visibility toggling should be inverted + * @return \FML\Controls\Control|static */ public function addTooltipFeature(Control $tooltipControl, $stayOnClick = false, $invert = false) { $tooltip = new Tooltip($this, $tooltipControl, $stayOnClick, $invert); @@ -393,10 +419,10 @@ abstract class Control implements Renderable, ScriptFeatureable { * Add a dynamic Feature showing a Tooltip on hovering * * @param Label $tooltipControl Tooltip Control - * @param string $text The Text to display on the Tooltip Label - * @param bool $stayOnClick (optional) Whether the Tooltip should stay on Click - * @param bool $invert (optional) Whether the Visibility Toggling should be inverted - * @return \FML\Controls\Control + * @param string $text Text to display on the Tooltip Label + * @param bool $stayOnClick (optional) Whether the Tooltip should stay on click + * @param bool $invert (optional) Whether the visibility toggling should be inverted + * @return \FML\Controls\Control|static */ public function addTooltipLabelFeature(Label $tooltipControl, $text, $stayOnClick = false, $invert = false) { $tooltip = new Tooltip($this, $tooltipControl, $stayOnClick, $invert, $text); @@ -405,11 +431,11 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Add a Custom Control Script Text Part + * Add a custom Control Script text part * - * @param string $scriptText Script Text - * @param string $label (optional) Script Label Name - * @return \FML\Controls\Control + * @param string $scriptText Script text + * @param string $label (optional) Script label name + * @return \FML\Controls\Control|static */ public function addScriptText($scriptText, $label = ScriptLabel::MOUSECLICK) { $customText = new ControlScript($this, $scriptText, $label); @@ -420,7 +446,7 @@ abstract class Control implements Renderable, ScriptFeatureable { /** * Remove all Script Features * - * @return \FML\Controls\Control + * @return \FML\Controls\Control|static */ public function removeScriptFeatures() { $this->scriptFeatures = array(); @@ -439,19 +465,19 @@ abstract class Control implements Renderable, ScriptFeatureable { */ public function render(\DOMDocument $domDocument) { $xmlElement = $domDocument->createElement($this->tagName); - if ($this->id) { - $xmlElement->setAttribute('id', $this->id); + if ($this->controlId) { + $xmlElement->setAttribute('id', $this->controlId); } - if ($this->x != 0. || $this->y != 0. || $this->z != 0.) { - $xmlElement->setAttribute('posn', "{$this->x} {$this->y} {$this->z}"); + if ($this->posX || $this->posY || $this->posZ) { + $xmlElement->setAttribute('posn', "{$this->posX} {$this->posY} {$this->posZ}"); } if ($this->width >= 0. || $this->height >= 0.) { $xmlElement->setAttribute('sizen', "{$this->width} {$this->height}"); } - if ($this->hAlign) { + if ($this->hAlign !== self::LEFT) { $xmlElement->setAttribute('halign', $this->hAlign); } - if ($this->vAlign) { + if ($this->vAlign !== self::TOP) { $xmlElement->setAttribute('valign', $this->vAlign); } if ($this->scale != 1.) { @@ -460,6 +486,9 @@ abstract class Control implements Renderable, ScriptFeatureable { if ($this->hidden) { $xmlElement->setAttribute('hidden', $this->hidden); } + if ($this->rotation) { + $xmlElement->setAttribute('rot', $this->rotation); + } if (!empty($this->classes)) { $classes = implode(' ', $this->classes); $xmlElement->setAttribute('class', $classes); @@ -468,7 +497,7 @@ abstract class Control implements Renderable, ScriptFeatureable { } /** - * Get the ManiaScript Class of the Control + * Get the ManiaScript class of the Control * * @return string */ diff --git a/application/core/Libs/FML/Controls/Entry.php b/application/core/Libs/FML/Controls/Entry.php index 55407b25..a33340ef 100644 --- a/application/core/Libs/FML/Controls/Entry.php +++ b/application/core/Libs/FML/Controls/Entry.php @@ -18,40 +18,20 @@ use FML\Types\TextFormatable; */ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextFormatable { /* - * Protected Properties + * Protected properties */ - protected $name = ''; + protected $tagName = 'entry'; + protected $name = null; protected $default = null; - protected $autoNewLine = 0; - protected $scriptEvents = 0; - protected $style = ''; - protected $textColor = ''; + protected $autoNewLine = null; + protected $scriptEvents = null; + protected $style = null; + protected $textColor = null; protected $textSize = -1; - protected $focusAreaColor1 = ''; - protected $focusAreaColor2 = ''; + protected $focusAreaColor1 = null; + protected $focusAreaColor2 = null; protected $autoComplete = null; - /** - * Construct a new Entry Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->tagName = 'entry'; - } - - /** - * Create a new Entry Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Entry - */ - public static function create($id = null) { - $entry = new Entry($id); - return $entry; - } - /** * @see \FML\Controls\Control::getManiaScriptClass() */ @@ -60,7 +40,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF } /** - * Get the Entry Name + * Get the Entry name * * @return string */ @@ -69,9 +49,9 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF } /** - * Set Entry Name + * Set Entry name * - * @param string $name Entry Name + * @param string $name Entry name * @return \FML\Controls\Entry */ public function setName($name) { @@ -80,7 +60,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF } /** - * Get the Default Value + * Get the default value * * @return mixed */ @@ -89,10 +69,10 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF } /** - * Set Default Value + * Set default value * - * @param string $default Default Value - * @return \FML\Controls\Entry + * @param string $default Default value + * @return \FML\Controls\Entry|static */ public function setDefault($default) { $this->default = $default; @@ -156,10 +136,10 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF } /** - * Set Auto Completion + * Set auto completion * - * @param bool $autoComplete Whether the Default Value should be automatically completed based on the current Request Parameters - * @return \FML\Controls\Entry + * @param bool $autoComplete Whether the default value should be automatically completed based on the current request parameters + * @return \FML\Controls\Entry|static */ public function setAutoComplete($autoComplete) { $this->autoComplete = (bool)$autoComplete; @@ -169,8 +149,8 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF /** * Add a dynamic Feature submitting the Entry * - * @param string $url Submit Url - * @return \FML\Controls\Entry + * @param string $url Submit url + * @return \FML\Controls\Entry|static */ public function addSubmitFeature($url) { $entrySubmit = new EntrySubmit($this, $url); @@ -186,7 +166,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF if ($this->name) { $xmlElement->setAttribute('name', $this->name); } - if ($this->default !== null) { + if (!is_null($this->default)) { $xmlElement->setAttribute('default', $this->default); } else if ($this->autoComplete) { $value = null; diff --git a/application/core/Libs/FML/Controls/FileEntry.php b/application/core/Libs/FML/Controls/FileEntry.php index ff5dc3bc..8b832af8 100644 --- a/application/core/Libs/FML/Controls/FileEntry.php +++ b/application/core/Libs/FML/Controls/FileEntry.php @@ -12,30 +12,10 @@ namespace FML\Controls; */ class FileEntry extends Entry { /* - * Protected Properties + * Protected properties */ - protected $folder = ''; - - /** - * Construct a new FileEntry Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->tagName = 'fileentry'; - } - - /** - * Create a new FileEntry Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\FileEntry - */ - public static function create($id = null) { - $fileEntry = new FileEntry($id); - return $fileEntry; - } + protected $tagName = 'fileentry'; + protected $folder = null; /** * @see \FML\Controls\Control::getManiaScriptClass() @@ -45,10 +25,10 @@ class FileEntry extends Entry { } /** - * Set Folder + * Set the base folder * - * @param string $folder Base Folder - * @return \FML\Controls\FileEntry + * @param string $folder Base folder + * @return \FML\Controls\FileEntry|static */ public function setFolder($folder) { $this->folder = (string)$folder; diff --git a/application/core/Libs/FML/Controls/Frame.php b/application/core/Libs/FML/Controls/Frame.php index fa8eb16b..2b7f37e7 100644 --- a/application/core/Libs/FML/Controls/Frame.php +++ b/application/core/Libs/FML/Controls/Frame.php @@ -17,33 +17,14 @@ use FML\Types\ScriptFeatureable; */ class Frame extends Control implements Container { /* - * Protected Properties + * Protected properties */ + protected $tagName = 'frame'; + /** @var Renderable[] $children */ protected $children = array(); /** @var Format $format */ protected $format = null; - /** - * Construct a new Frame Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->tagName = 'frame'; - } - - /** - * Create a new Frame Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Frame - */ - public static function create($id = null) { - $frame = new Frame($id); - return $frame; - } - /** * @see \FML\Controls\Control::getManiaScriptClass() */ @@ -110,7 +91,6 @@ class Frame extends Control implements Container { $xmlElement->appendChild($formatXml); } foreach ($this->children as $child) { - /** @var Renderable $child */ $childXmlElement = $child->render($domDocument); $xmlElement->appendChild($childXmlElement); } diff --git a/application/core/Libs/FML/Controls/Frame3d.php b/application/core/Libs/FML/Controls/Frame3d.php index f12e38cd..efbed63c 100644 --- a/application/core/Libs/FML/Controls/Frame3d.php +++ b/application/core/Libs/FML/Controls/Frame3d.php @@ -29,39 +29,19 @@ class Frame3d extends Frame implements Scriptable { const STYLE_Window = 'Window'; /* - * Protected Properties + * Protected properties */ - protected $style3dId = ''; + protected $tagName = 'frame3d'; + protected $style3dId = null; /** @var Style3d $style3d */ protected $style3d = null; - protected $scriptEvents = 0; + protected $scriptEvents = null; /** - * Create a new Frame3d Control + * Set Style3d id * - * @param string $id (optional) Control Id - * @return \FML\Controls\Frame3d - */ - public static function create($id = null) { - $frame3d = new Frame3d($id); - return $frame3d; - } - - /** - * Construct a new Frame3d Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->tagName = 'frame3d'; - } - - /** - * Set Style3d Id - * - * @param string $style3dId Style3d Id - * @return \FML\Controls\Frame3d + * @param string $style3dId Style3d id + * @return \FML\Controls\Frame3d|static */ public function setStyle3dId($style3dId) { $this->style3dId = (string)$style3dId; @@ -72,11 +52,12 @@ class Frame3d extends Frame implements Scriptable { /** * Set Style3d * - * @param Style3d $style3d Style3d Object - * @return \FML\Controls\Frame3d + * @param Style3d $style3d Style3d object + * @return \FML\Controls\Frame3d|static */ public function setStyle3d(Style3d $style3d) { - $this->style3d = $style3d; + $this->style3d = $style3d; + $this->style3dId = null; return $this; } diff --git a/application/core/Libs/FML/Controls/FrameInstance.php b/application/core/Libs/FML/Controls/FrameInstance.php index ca9c2f7d..25b87d93 100644 --- a/application/core/Libs/FML/Controls/FrameInstance.php +++ b/application/core/Libs/FML/Controls/FrameInstance.php @@ -5,7 +5,7 @@ namespace FML\Controls; use FML\Elements\FrameModel; /** - * Class representing an Instance of a Frame Model + * Class representing an instance of a Frame Model * (CMlFrame) * * @author steeffeen @@ -14,31 +14,42 @@ use FML\Elements\FrameModel; */ class FrameInstance extends Control { /* - * Protected Properties + * Protected properties */ - protected $modelId = ''; + protected $tagName = 'frameinstance'; + protected $modelId = null; /** @var FrameModel $model */ protected $model = null; /** - * Construct a new Frame Instance + * Create a new Frame Instance object * - * @param string $modelId (optional) Frame Model Id - * @param string $controlId (optional) Control Id + * @param string $modelId (optional) Frame Model id + * @param string $controlId (optional) Frame id + * @return \FML\Controls\FrameInstance|static + */ + public static function create($modelId = null, $controlId = null) { + return new static($modelId, $controlId); + } + + /** + * Construct a new Frame Instance object + * + * @param string $modelId (optional) Frame Model id + * @param string $controlId (optional) Frame id */ public function __construct($modelId = null, $controlId = null) { parent::__construct($controlId); - $this->tagName = 'frameinstance'; - if ($modelId !== null) { + if (!is_null($modelId)) { $this->setModelId($modelId); } } /** - * Set Model Id + * Set Frame Model id * - * @param string $modelId Model Id - * @return \FML\Controls\FrameInstance + * @param string $modelId Frame Model id + * @return \FML\Controls\FrameInstance|static */ public function setModelId($modelId) { $this->modelId = (string)$modelId; @@ -47,15 +58,15 @@ class FrameInstance extends Control { } /** - * Create a new Frame Instance + * Set Frame Model * - * @param string $modelId (optional) Frame Model Id - * @param string $controlId (optional) Control Id - * @return \FML\Controls\Frame + * @param FrameModel $frameModel Frame Model + * @return \FML\Controls\FrameInstance|static */ - public static function create($modelId = null, $controlId = null) { - $frameInstance = new FrameInstance($modelId, $controlId); - return $frameInstance; + public function setModel(FrameModel $frameModel) { + $this->model = $frameModel; + $this->modelId = null; + return $this; } /** @@ -65,18 +76,6 @@ class FrameInstance extends Control { return 'CMlFrame'; } - /** - * Set Frame Model to use - * - * @param FrameModel $frameModel Frame Model - * @return \FML\Controls\FrameInstance - */ - public function setModel(FrameModel $frameModel) { - $this->model = $frameModel; - $this->modelId = ''; - return $this; - } - /** * @see \FML\Renderable::render() */ diff --git a/application/core/Libs/FML/Controls/Gauge.php b/application/core/Libs/FML/Controls/Gauge.php index 3b79ef84..51ff28ee 100644 --- a/application/core/Libs/FML/Controls/Gauge.php +++ b/application/core/Libs/FML/Controls/Gauge.php @@ -22,38 +22,18 @@ class Gauge extends Control implements Styleable { const STYLE_ProgressBarSmall = 'ProgressBarSmall'; /* - * Protected Properties + * Protected properties */ + protected $tagName = 'gauge'; protected $ratio = 0.; protected $grading = 1.; - protected $color = ''; + protected $color = null; protected $rotation = 0.; - protected $centered = 0; - protected $clan = 0; + protected $centered = null; + protected $clan = null; protected $drawBg = 1; protected $drawBlockBg = 1; - protected $style = ''; - - /** - * Construct a new Gauge Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->tagName = 'gauge'; - } - - /** - * Create a new Gauge Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Gauge - */ - public static function create($id = null) { - $gauge = new Gauge($id); - return $gauge; - } + protected $style = null; /** * @see \FML\Controls\Control::getManiaScriptClass() @@ -63,10 +43,10 @@ class Gauge extends Control implements Styleable { } /** - * Set Ratio + * Set ratio * - * @param float $ratio Ratio Value - * @return \FML\Controls\Gauge + * @param float $ratio Ratio value + * @return \FML\Controls\Gauge|static */ public function setRatio($ratio) { $this->ratio = (float)$ratio; @@ -74,10 +54,10 @@ class Gauge extends Control implements Styleable { } /** - * Set Grading + * Set grading * - * @param float $grading Grading Value - * @return \FML\Controls\Gauge + * @param float $grading Grading value + * @return \FML\Controls\Gauge|static */ public function setGrading($grading) { $this->grading = (float)$grading; @@ -85,10 +65,10 @@ class Gauge extends Control implements Styleable { } /** - * Set Color + * Set color * - * @param string $color Gauge Color - * @return \FML\Controls\Gauge + * @param string $color Gauge color + * @return \FML\Controls\Gauge|static */ public function setColor($color) { $this->color = (string)$color; @@ -96,10 +76,10 @@ class Gauge extends Control implements Styleable { } /** - * Set Rotation + * Set rotation * - * @param float $rotation Gauge Rotation - * @return \FML\Controls\Gauge + * @param float $rotation Gauge rotation + * @return \FML\Controls\Gauge|static */ public function setRotation($rotation) { $this->rotation = (float)$rotation; @@ -107,10 +87,10 @@ class Gauge extends Control implements Styleable { } /** - * Set Centered + * Set centered * - * @param bool $centered Whether Gauge is centered - * @return \FML\Controls\Gauge + * @param bool $centered Whether the Gauge is centered + * @return \FML\Controls\Gauge|static */ public function setCentered($centered) { $this->centered = ($centered ? 1 : 0); @@ -118,10 +98,10 @@ class Gauge extends Control implements Styleable { } /** - * Set Clan + * Set clan * * @param int $clan Clan number - * @return \FML\Controls\Gauge + * @return \FML\Controls\Gauge|static */ public function setClan($clan) { $this->clan = (int)$clan; @@ -129,10 +109,10 @@ class Gauge extends Control implements Styleable { } /** - * Set Draw Background + * Set draw background * - * @param bool $drawBg Whether Gauge Background should be drawn - * @return \FML\Controls\Gauge + * @param bool $drawBg Whether the Gauges background should be drawn + * @return \FML\Controls\Gauge|static */ public function setDrawBg($drawBg) { $this->drawBg = ($drawBg ? 1 : 0); @@ -140,10 +120,10 @@ class Gauge extends Control implements Styleable { } /** - * Set Draw Block Background + * Set draw block background * - * @param bool $drawBlockBg Whether Gauge Block Background should be drawn - * @return \FML\Controls\Gauge + * @param bool $drawBlockBg Whether the Gauges block background should be drawn + * @return \FML\Controls\Gauge|static */ public function setDrawBlockBg($drawBlockBg) { $this->drawBlockBg = ($drawBlockBg ? 1 : 0); diff --git a/application/core/Libs/FML/Controls/Label.php b/application/core/Libs/FML/Controls/Label.php index e911e362..cdc6ddfa 100644 --- a/application/core/Libs/FML/Controls/Label.php +++ b/application/core/Libs/FML/Controls/Label.php @@ -20,49 +20,29 @@ use FML\Types\TextFormatable; */ class Label extends Control implements Actionable, Linkable, NewLineable, Scriptable, Styleable, TextFormatable { /* - * Protected Properties + * Protected properties */ - protected $text = ''; - protected $textId = ''; - protected $textPrefix = ''; - protected $textEmboss = 0; - protected $translate = 0; + protected $tagName = 'label'; + protected $text = null; + protected $textId = null; + protected $textPrefix = null; + protected $textEmboss = null; + protected $translate = null; protected $maxLines = -1; - protected $action = ''; + protected $opacity = 1.; + protected $action = null; protected $actionKey = -1; - protected $url = ''; - protected $urlId = ''; - protected $manialink = ''; - protected $manialinkId = ''; - protected $autoNewLine = 0; - protected $scriptEvents = 0; - protected $style = ''; + protected $url = null; + protected $urlId = null; + protected $manialink = null; + protected $manialinkId = null; + protected $autoNewLine = null; + protected $scriptEvents = null; + protected $style = null; protected $textSize = -1; - protected $textColor = ''; - protected $focusAreaColor1 = ''; - protected $focusAreaColor2 = ''; - - /** - * Construct a new Label Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->tagName = 'label'; - $this->setZ(1); - } - - /** - * Create a new Label Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Label - */ - public static function create($id = null) { - $label = new Label($id); - return $label; - } + protected $textColor = null; + protected $focusAreaColor1 = null; + protected $focusAreaColor2 = null; /** * @see \FML\Controls\Control::getManiaScriptClass() @@ -72,10 +52,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script } /** - * Set Text + * Set text * - * @param string $text Text Value - * @return \FML\Controls\Label + * @param string $text Text value + * @return \FML\Controls\Label|static */ public function setText($text) { $this->text = (string)$text; @@ -83,10 +63,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script } /** - * Set Text Id to use from the Dico + * Set text id to use from Dico * - * @param string $textId Text Id - * @return \FML\Controls\Label + * @param string $textId Text id + * @return \FML\Controls\Label|static */ public function setTextId($textId) { $this->textId = (string)$textId; @@ -94,10 +74,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script } /** - * Set Text Prefix + * Set text prefix * - * @param string $textPrefix Text Prefix - * @return \FML\Controls\Label + * @param string $textPrefix Text prefix + * @return \FML\Controls\Label|static */ public function setTextPrefix($textPrefix) { $this->textPrefix = (string)$textPrefix; @@ -105,10 +85,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script } /** - * Set Text Emboss + * Set text emboss * - * @param bool $textEmboss Whether Text should be embossed - * @return \FML\Controls\Label + * @param bool $textEmboss Whether the text should be embossed + * @return \FML\Controls\Label|static */ public function setTextEmboss($textEmboss) { $this->textEmboss = ($textEmboss ? 1 : 0); @@ -116,10 +96,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script } /** - * Set Translate + * Set translate * - * @param bool $translate Whether Text should be translated - * @return \FML\Controls\Label + * @param bool $translate Whether the text should be translated + * @return \FML\Controls\Label|static */ public function setTranslate($translate) { $this->translate = ($translate ? 1 : 0); @@ -127,10 +107,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script } /** - * Set Max Lines Count + * Set max lines count * - * @param int $maxLines Max Lines Count - * @return \FML\Controls\Label + * @param int $maxLines Max lines count + * @return \FML\Controls\Label|static */ public function setMaxLines($maxLines) { $this->maxLines = (int)$maxLines; @@ -249,11 +229,11 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script } /** - * Add a dynamic Feature showing the current Time + * Add a dynamic Feature showing the current time * - * @param bool $showSeconds (optional) Whether the Seconds should be shown - * @param bool $showFullDate (optional) Whether the Date should be shown - * @return \FML\Controls\Label + * @param bool $showSeconds (optional) Whether the seconds should be shown + * @param bool $showFullDate (optional) Whether the date should be shown + * @return \FML\Controls\Label|static */ public function addClockFeature($showSeconds = true, $showFullDate = false) { $clock = new Clock($this, $showSeconds, $showFullDate); @@ -262,7 +242,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script } /** - * @see \FML\Control::render() + * @see \FML\Types\Renderable::render() */ public function render(\DOMDocument $domDocument) { $xmlElement = parent::render($domDocument); @@ -284,6 +264,9 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script if ($this->maxLines >= 0) { $xmlElement->setAttribute('maxlines', $this->maxLines); } + if ($this->opacity != 1.) { + $xmlElement->setAttribute('opacity', $this->opacity); + } if (strlen($this->action) > 0) { $xmlElement->setAttribute('action', $this->action); } diff --git a/application/core/Libs/FML/Controls/Labels/Label_Button.php b/application/core/Libs/FML/Controls/Labels/Label_Button.php index 7e5f5b1c..1a33d2c4 100644 --- a/application/core/Libs/FML/Controls/Labels/Label_Button.php +++ b/application/core/Libs/FML/Controls/Labels/Label_Button.php @@ -5,7 +5,7 @@ namespace FML\Controls\Labels; use FML\Controls\Label; /** - * Label Class for Button Styles + * Label class for button styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -33,24 +33,4 @@ class Label_Button extends Label { const STYLE_CardButtonSmallXXXL = 'CardButtonSmallXXXL'; const STYLE_CardMain_Quit = 'CardMain_Quit'; const STYLE_CardMain_Tool = 'CardMain_Tool'; - - /** - * Create a new Label_Button Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Labels\Label_Button - */ - public static function create($id = null) { - $labelButton = new Label_Button($id); - return $labelButton; - } - - /** - * Construct a new Label_Button Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - } } diff --git a/application/core/Libs/FML/Controls/Labels/Label_Text.php b/application/core/Libs/FML/Controls/Labels/Label_Text.php index fa8354c7..4ad26344 100644 --- a/application/core/Libs/FML/Controls/Labels/Label_Text.php +++ b/application/core/Libs/FML/Controls/Labels/Label_Text.php @@ -5,7 +5,7 @@ namespace FML\Controls\Labels; use FML\Controls\Label; /** - * Label Class for Text Styles + * Label class for text styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -94,24 +94,4 @@ class Label_Text extends Label { const STYLE_UiDriving_BgBottom = 'UiDriving_BgBottom'; const STYLE_UiDriving_BgCard = 'UiDriving_BgCard'; const STYLE_UiDriving_BgCenter = 'UiDriving_BgCenter'; - - /** - * Create a new Label_Text Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Labels\Label_Text - */ - public static function create($id = null) { - $labelText = new Label_Text($id); - return $labelText; - } - - /** - * Construct a new Label_Text Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - } } diff --git a/application/core/Libs/FML/Controls/Quad.php b/application/core/Libs/FML/Controls/Quad.php index 1b3970be..c631156d 100644 --- a/application/core/Libs/FML/Controls/Quad.php +++ b/application/core/Libs/FML/Controls/Quad.php @@ -20,47 +20,26 @@ use FML\Types\SubStyleable; */ class Quad extends Control implements Actionable, BgColorable, Linkable, Scriptable, Styleable, SubStyleable { /* - * Protected Properties + * Protected properties */ - protected $image = ''; - protected $imageId = ''; - protected $imageFocus = ''; - protected $imageFocusId = ''; - protected $colorize = ''; - protected $modulizeColor = ''; + protected $tagName = 'quad'; + protected $image = null; + protected $imageId = null; + protected $imageFocus = null; + protected $imageFocusId = null; + protected $colorize = null; + protected $modulizeColor = null; protected $autoScale = 1; - protected $action = ''; + protected $action = null; protected $actionKey = -1; - protected $bgColor = ''; - protected $url = ''; - protected $urlId = ''; - protected $manialink = ''; - protected $manialinkId = ''; - protected $scriptEvents = 0; - protected $style = ''; - protected $subStyle = ''; - - /** - * Construct a new Quad Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->tagName = 'quad'; - $this->setZ(-1); - } - - /** - * Create a new Quad Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quad - */ - public static function create($id = null) { - $quad = new Quad($id); - return $quad; - } + protected $bgColor = null; + protected $url = null; + protected $urlId = null; + protected $manialink = null; + protected $manialinkId = null; + protected $scriptEvents = null; + protected $style = null; + protected $subStyle = null; /** * @see \FML\Controls\Control::getManiaScriptClass() @@ -70,10 +49,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta } /** - * Set Image Url + * Set image url * - * @param string $image Image Url - * @return \FML\Controls\Quad + * @param string $image Image url + * @return \FML\Controls\Quad|static */ public function setImage($image) { $this->image = (string)$image; @@ -81,10 +60,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta } /** - * Set Image Id to use from the Dico + * Set image id to use from Dico * - * @param string $imageId Image Id - * @return \FML\Controls\Quad + * @param string $imageId Image id + * @return \FML\Controls\Quad|static */ public function setImageId($imageId) { $this->imageId = (string)$imageId; @@ -92,10 +71,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta } /** - * Set Focus Image Url + * Set focus image url * - * @param string $imageFocus Focus Image Url - * @return \FML\Controls\Quad + * @param string $imageFocus Focus image url + * @return \FML\Controls\Quad|static */ public function setImageFocus($imageFocus) { $this->imageFocus = (string)$imageFocus; @@ -103,10 +82,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta } /** - * Set Focus Image Id to use from the Dico + * Set focus image id to use from Dico * - * @param string $imageFocusId Focus Image Id - * @return \FML\Controls\Quad + * @param string $imageFocusId Focus image id + * @return \FML\Controls\Quad|static */ public function setImageFocusId($imageFocusId) { $this->imageFocusId = (string)$imageFocusId; @@ -114,10 +93,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta } /** - * Set Colorization + * Set colorization * - * @param string $colorize Colorize Value - * @return \FML\Controls\Quad + * @param string $colorize Colorize value + * @return \FML\Controls\Quad|static */ public function setColorize($colorize) { $this->colorize = (string)$colorize; @@ -125,10 +104,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta } /** - * Set Modulization + * Set modulization * - * @param string $modulizeColor Modulize Value - * @return \FML\Controls\Quad + * @param string $modulizeColor Modulize value + * @return \FML\Controls\Quad|static */ public function setModulizeColor($modulizeColor) { $this->modulizeColor = (string)$modulizeColor; @@ -136,10 +115,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta } /** - * Disable the automatic Image Scaling + * Disable the automatic image scaling * - * @param bool $autoScale Whether the Image should scale automatically - * @return \FML\Controls\Quad + * @param bool $autoScale Whether the image should scale automatically + * @return \FML\Controls\Quad|static */ public function setAutoScale($autoScale) { $this->autoScale = ($autoScale ? 1 : 0); @@ -246,7 +225,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta * Apply the given CheckBox Design * * @param CheckBoxDesign $checkBoxDesign CheckBox Design - * @return \FML\Controls\Quad + * @return \FML\Controls\Quad|static */ public function applyCheckBoxDesign(CheckBoxDesign $checkBoxDesign) { $checkBoxDesign->applyToQuad($this); @@ -254,7 +233,7 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta } /** - * @see \FML\Control::render() + * @see \FML\Types\Renderable::render() */ public function render(\DOMDocument $domDocument) { $xmlElement = parent::render($domDocument); diff --git a/application/core/Libs/FML/Controls/Quads/Quad_321Go.php b/application/core/Libs/FML/Controls/Quads/Quad_321Go.php index df6ef614..d4525e20 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_321Go.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_321Go.php @@ -5,40 +5,24 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for '321Go' Style + * Quad class for '321Go' styles * - * @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 Quad_321Go extends Quad { /* * Constants */ - const STYLE = '321Go'; - const SUBSTYLE_3 = '3'; - const SUBSTYLE_2 = '2'; - const SUBSTYLE_1 = '1'; + const STYLE = '321Go'; + const SUBSTYLE_3 = '3'; + const SUBSTYLE_2 = '2'; + const SUBSTYLE_1 = '1'; const SUBSTYLE_Go = 'Go!'; - /** - * Create a new Quad_321Go Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_321Go + /* + * Protected properties */ - public static function create($id = null) { - $quad321Go = new Quad_321Go($id); - return $quad321Go; - } - - /** - * Construct a new Quad_321Go Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_BgRaceScore2.php b/application/core/Libs/FML/Controls/Quads/Quad_BgRaceScore2.php index a98bbb06..c0db325e 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_BgRaceScore2.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_BgRaceScore2.php @@ -5,63 +5,47 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'BgRaceScore2' Style + * Quad class for 'BgRaceScore2' styles * - * @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 Quad_BgRaceScore2 extends Quad { /* * Constants */ - const STYLE = 'BgRaceScore2'; - const SUBSTYLE_BgCardPlayer = 'BgCardPlayer'; - const SUBSTYLE_BgCardServer = 'BgCardServer'; - const SUBSTYLE_BgScores = 'BgScores'; - const SUBSTYLE_Cartouche = 'Cartouche'; - const SUBSTYLE_CartoucheLine = 'CartoucheLine'; - const SUBSTYLE_CupFinisher = 'CupFinisher'; + const STYLE = 'BgRaceScore2'; + const SUBSTYLE_BgCardPlayer = 'BgCardPlayer'; + const SUBSTYLE_BgCardServer = 'BgCardServer'; + const SUBSTYLE_BgScores = 'BgScores'; + const SUBSTYLE_Cartouche = 'Cartouche'; + const SUBSTYLE_CartoucheLine = 'CartoucheLine'; + const SUBSTYLE_CupFinisher = 'CupFinisher'; const SUBSTYLE_CupPotentialFinisher = 'CupPotentialFinisher'; - const SUBSTYLE_Fame = 'Fame'; - const SUBSTYLE_Handle = 'Handle'; - const SUBSTYLE_HandleBlue = 'HandleBlue'; - const SUBSTYLE_HandleRed = 'HandleRed'; - const SUBSTYLE_HandleSelectable = 'HandleSelectable'; - const SUBSTYLE_IsLadderDisabled = 'IsLadderDisabled'; - const SUBSTYLE_IsLocalPlayer = 'IsLocalPlayer'; - const SUBSTYLE_LadderPoints = 'LadderPoints'; - const SUBSTYLE_LadderRank = 'LadderRank'; - const SUBSTYLE_Laps = 'Laps'; - const SUBSTYLE_Podium = 'Podium'; - const SUBSTYLE_Points = 'Points'; - const SUBSTYLE_SandTimer = 'SandTimer'; - const SUBSTYLE_ScoreLink = 'ScoreLink'; - const SUBSTYLE_ScoreReplay = 'ScoreReplay'; - const SUBSTYLE_SendScore = 'SendScore'; - const SUBSTYLE_Speaking = 'Speaking'; - const SUBSTYLE_Spectator = 'Spectator'; - const SUBSTYLE_Tv = 'Tv'; - const SUBSTYLE_Warmup = 'Warmup'; + const SUBSTYLE_Fame = 'Fame'; + const SUBSTYLE_Handle = 'Handle'; + const SUBSTYLE_HandleBlue = 'HandleBlue'; + const SUBSTYLE_HandleRed = 'HandleRed'; + const SUBSTYLE_HandleSelectable = 'HandleSelectable'; + const SUBSTYLE_IsLadderDisabled = 'IsLadderDisabled'; + const SUBSTYLE_IsLocalPlayer = 'IsLocalPlayer'; + const SUBSTYLE_LadderPoints = 'LadderPoints'; + const SUBSTYLE_LadderRank = 'LadderRank'; + const SUBSTYLE_Laps = 'Laps'; + const SUBSTYLE_Podium = 'Podium'; + const SUBSTYLE_Points = 'Points'; + const SUBSTYLE_SandTimer = 'SandTimer'; + const SUBSTYLE_ScoreLink = 'ScoreLink'; + const SUBSTYLE_ScoreReplay = 'ScoreReplay'; + const SUBSTYLE_SendScore = 'SendScore'; + const SUBSTYLE_Speaking = 'Speaking'; + const SUBSTYLE_Spectator = 'Spectator'; + const SUBSTYLE_Tv = 'Tv'; + const SUBSTYLE_Warmup = 'Warmup'; - /** - * Create a new Quad_BgRaceScore2 Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_BgRaceScore2 + /* + * Protected properties */ - public static function create($id = null) { - $quadBgRaceScore2 = new Quad_BgRaceScore2($id); - return $quadBgRaceScore2; - } - - /** - * Construct a new Quad_BgRaceScore2 Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Bgs1.php b/application/core/Libs/FML/Controls/Quads/Quad_Bgs1.php index 4cbc8f64..435f5ec0 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Bgs1.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Bgs1.php @@ -5,102 +5,86 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Bgs1' Style + * Quad class for 'Bgs1' styles * - * @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 Quad_Bgs1 extends Quad { /* * Constants */ - const STYLE = 'Bgs1'; - const SUBSTYLE_ArrowDown = 'ArrowDown'; - const SUBSTYLE_ArrowLeft = 'ArrowLeft'; - const SUBSTYLE_ArrowRight = 'ArrowRight'; - const SUBSTYLE_ArrowUp = 'ArrowUp'; - const SUBSTYLE_BgButton = 'BgButton'; - const SUBSTYLE_BgButtonBig = 'BgButtonBig'; - const SUBSTYLE_BgButtonGlow = 'BgButtonGlow'; - const SUBSTYLE_BgButtonGrayed = 'BgButtonGrayed'; - const SUBSTYLE_BgButtonOff = 'BgButtonOff'; - const SUBSTYLE_BgButtonShadow = 'BgButtonShadow'; - const SUBSTYLE_BgButtonSmall = 'BgButtonSmall'; - const SUBSTYLE_BgCard = 'BgCard'; - const SUBSTYLE_BgCard1 = 'BgCard1'; - const SUBSTYLE_BgCard2 = 'BgCard2'; - const SUBSTYLE_BgCard3 = 'BgCard3'; - const SUBSTYLE_BgCardBuddy = 'BgCardBuddy'; - const SUBSTYLE_BgCardChallenge = 'BgCardChallenge'; - const SUBSTYLE_BgCardFolder = 'BgCardFolder'; + const STYLE = 'Bgs1'; + const SUBSTYLE_ArrowDown = 'ArrowDown'; + const SUBSTYLE_ArrowLeft = 'ArrowLeft'; + const SUBSTYLE_ArrowRight = 'ArrowRight'; + const SUBSTYLE_ArrowUp = 'ArrowUp'; + const SUBSTYLE_BgButton = 'BgButton'; + const SUBSTYLE_BgButtonBig = 'BgButtonBig'; + const SUBSTYLE_BgButtonGlow = 'BgButtonGlow'; + const SUBSTYLE_BgButtonGrayed = 'BgButtonGrayed'; + const SUBSTYLE_BgButtonOff = 'BgButtonOff'; + const SUBSTYLE_BgButtonShadow = 'BgButtonShadow'; + const SUBSTYLE_BgButtonSmall = 'BgButtonSmall'; + const SUBSTYLE_BgCard = 'BgCard'; + const SUBSTYLE_BgCard1 = 'BgCard1'; + const SUBSTYLE_BgCard2 = 'BgCard2'; + const SUBSTYLE_BgCard3 = 'BgCard3'; + const SUBSTYLE_BgCardBuddy = 'BgCardBuddy'; + const SUBSTYLE_BgCardChallenge = 'BgCardChallenge'; + const SUBSTYLE_BgCardFolder = 'BgCardFolder'; const SUBSTYLE_BgCardInventoryItem = 'BgCardInventoryItem'; - const SUBSTYLE_BgCardList = 'BgCardList'; - const SUBSTYLE_BgCardOnline = 'BgCardOnline'; - const SUBSTYLE_BgCardPlayer = 'BgCardPlayer'; - const SUBSTYLE_BgCardProperty = 'BgCardProperty'; - const SUBSTYLE_BgCardSystem = 'BgCardSystem'; - const SUBSTYLE_BgCardZone = 'BgCardZone'; - const SUBSTYLE_BgColorContour = 'BgColorContour'; - const SUBSTYLE_BgDialogBlur = 'BgDialogBlur'; - const SUBSTYLE_BgEmpty = 'BgEmpty'; - const SUBSTYLE_BgGradBottom = 'BgGradBottom'; - const SUBSTYLE_BgGradLeft = 'BgGradLeft'; - const SUBSTYLE_BgGradRight = 'BgGradRight'; - const SUBSTYLE_BgGradTop = 'BgGradTop'; - const SUBSTYLE_BgGradV = 'BgGradV'; - const SUBSTYLE_BgHealthBar = 'BgHealthBar'; - const SUBSTYLE_BgIconBorder = 'BgIconBorder'; - const SUBSTYLE_BgList = 'BgList'; - const SUBSTYLE_BgListLine = 'BgListLine'; - const SUBSTYLE_BgPager = 'BgPager'; - const SUBSTYLE_BgProgressBar = 'BgProgressBar'; - const SUBSTYLE_BgShadow = 'BgShadow'; - const SUBSTYLE_BgSlider = 'BgSlider'; - const SUBSTYLE_BgSystemBar = 'BgSystemBar'; - const SUBSTYLE_BgTitle2 = 'BgTitle2'; - const SUBSTYLE_BgTitle3 = 'BgTitle3'; - const SUBSTYLE_BgTitle3_1 = 'BgTitle3_1'; - const SUBSTYLE_BgTitle3_2 = 'BgTitle3_2'; - const SUBSTYLE_BgTitle3_3 = 'BgTitle3_3'; - const SUBSTYLE_BgTitle3_4 = 'BgTitle3_4'; - const SUBSTYLE_BgTitle3_5 = 'BgTitle3_5'; - const SUBSTYLE_BgTitleGlow = 'BgTitleGlow'; - const SUBSTYLE_BgTitlePage = 'BgTitlePage'; - const SUBSTYLE_BgTitleShadow = 'BgTitleShadow'; - const SUBSTYLE_BgWindow1 = 'BgWindow1'; - const SUBSTYLE_BgWindow2 = 'BgWindow2'; - const SUBSTYLE_BgWindow3 = 'BgWindow3'; - const SUBSTYLE_BgWindow4 = 'BgWindow4'; - const SUBSTYLE_EnergyBar = 'EnergyBar'; - const SUBSTYLE_EnergyTeam2 = 'EnergyTeam2'; - const SUBSTYLE_Glow = 'Glow'; - const SUBSTYLE_HealthBar = 'HealthBar'; - const SUBSTYLE_NavButton = 'NavButton'; - const SUBSTYLE_NavButtonBlink = 'NavButtonBlink'; - const SUBSTYLE_NavButtonQuit = 'NavButtonQuit'; - const SUBSTYLE_ProgressBar = 'ProgressBar'; - const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall'; - const SUBSTYLE_Shadow = 'Shadow'; + const SUBSTYLE_BgCardList = 'BgCardList'; + const SUBSTYLE_BgCardOnline = 'BgCardOnline'; + const SUBSTYLE_BgCardPlayer = 'BgCardPlayer'; + const SUBSTYLE_BgCardProperty = 'BgCardProperty'; + const SUBSTYLE_BgCardSystem = 'BgCardSystem'; + const SUBSTYLE_BgCardZone = 'BgCardZone'; + const SUBSTYLE_BgColorContour = 'BgColorContour'; + const SUBSTYLE_BgDialogBlur = 'BgDialogBlur'; + const SUBSTYLE_BgEmpty = 'BgEmpty'; + const SUBSTYLE_BgGradBottom = 'BgGradBottom'; + const SUBSTYLE_BgGradLeft = 'BgGradLeft'; + const SUBSTYLE_BgGradRight = 'BgGradRight'; + const SUBSTYLE_BgGradTop = 'BgGradTop'; + const SUBSTYLE_BgGradV = 'BgGradV'; + const SUBSTYLE_BgHealthBar = 'BgHealthBar'; + const SUBSTYLE_BgIconBorder = 'BgIconBorder'; + const SUBSTYLE_BgList = 'BgList'; + const SUBSTYLE_BgListLine = 'BgListLine'; + const SUBSTYLE_BgPager = 'BgPager'; + const SUBSTYLE_BgProgressBar = 'BgProgressBar'; + const SUBSTYLE_BgShadow = 'BgShadow'; + const SUBSTYLE_BgSlider = 'BgSlider'; + const SUBSTYLE_BgSystemBar = 'BgSystemBar'; + const SUBSTYLE_BgTitle2 = 'BgTitle2'; + const SUBSTYLE_BgTitle3 = 'BgTitle3'; + const SUBSTYLE_BgTitle3_1 = 'BgTitle3_1'; + const SUBSTYLE_BgTitle3_2 = 'BgTitle3_2'; + const SUBSTYLE_BgTitle3_3 = 'BgTitle3_3'; + const SUBSTYLE_BgTitle3_4 = 'BgTitle3_4'; + const SUBSTYLE_BgTitle3_5 = 'BgTitle3_5'; + const SUBSTYLE_BgTitleGlow = 'BgTitleGlow'; + const SUBSTYLE_BgTitlePage = 'BgTitlePage'; + const SUBSTYLE_BgTitleShadow = 'BgTitleShadow'; + const SUBSTYLE_BgWindow1 = 'BgWindow1'; + const SUBSTYLE_BgWindow2 = 'BgWindow2'; + const SUBSTYLE_BgWindow3 = 'BgWindow3'; + const SUBSTYLE_BgWindow4 = 'BgWindow4'; + const SUBSTYLE_EnergyBar = 'EnergyBar'; + const SUBSTYLE_EnergyTeam2 = 'EnergyTeam2'; + const SUBSTYLE_Glow = 'Glow'; + const SUBSTYLE_HealthBar = 'HealthBar'; + const SUBSTYLE_NavButton = 'NavButton'; + const SUBSTYLE_NavButtonBlink = 'NavButtonBlink'; + const SUBSTYLE_NavButtonQuit = 'NavButtonQuit'; + const SUBSTYLE_ProgressBar = 'ProgressBar'; + const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall'; + const SUBSTYLE_Shadow = 'Shadow'; - /** - * Create a new Quad_Bgs1 Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Bgs1 + /* + * Protected properties */ - public static function create($id = null) { - $quadBgs1 = new Quad_Bgs1($id); - return $quadBgs1; - } - - /** - * Construct a new Quad_Bgs1 Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Bgs1InRace.php b/application/core/Libs/FML/Controls/Quads/Quad_Bgs1InRace.php index c87cd3d0..9f939319 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Bgs1InRace.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Bgs1InRace.php @@ -5,102 +5,86 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Bgs1InRace' Style + * Quad class for 'Bgs1InRace' styles * - * @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 Quad_Bgs1InRace extends Quad { /* * Constants */ - const STYLE = 'Bgs1InRace'; - const SUBSTYLE_ArrowDown = 'ArrowDown'; - const SUBSTYLE_ArrowLeft = 'ArrowLeft'; - const SUBSTYLE_ArrowRight = 'ArrowRight'; - const SUBSTYLE_ArrowUp = 'ArrowUp'; - const SUBSTYLE_BgButton = 'BgButton'; - const SUBSTYLE_BgButtonBig = 'BgButtonBig'; - const SUBSTYLE_BgButtonGlow = 'BgButtonGlow'; - const SUBSTYLE_BgButtonGrayed = 'BgButtonGrayed'; - const SUBSTYLE_BgButtonOff = 'BgButtonOff'; - const SUBSTYLE_BgButtonShadow = 'BgButtonShadow'; - const SUBSTYLE_BgButtonSmall = 'BgButtonSmall'; - const SUBSTYLE_BgCard = 'BgCard'; - const SUBSTYLE_BgCard1 = 'BgCard1'; - const SUBSTYLE_BgCard2 = 'BgCard2'; - const SUBSTYLE_BgCard3 = 'BgCard3'; - const SUBSTYLE_BgCardBuddy = 'BgCardBuddy'; - const SUBSTYLE_BgCardChallenge = 'BgCardChallenge'; - const SUBSTYLE_BgCardFolder = 'BgCardFolder'; + const STYLE = 'Bgs1InRace'; + const SUBSTYLE_ArrowDown = 'ArrowDown'; + const SUBSTYLE_ArrowLeft = 'ArrowLeft'; + const SUBSTYLE_ArrowRight = 'ArrowRight'; + const SUBSTYLE_ArrowUp = 'ArrowUp'; + const SUBSTYLE_BgButton = 'BgButton'; + const SUBSTYLE_BgButtonBig = 'BgButtonBig'; + const SUBSTYLE_BgButtonGlow = 'BgButtonGlow'; + const SUBSTYLE_BgButtonGrayed = 'BgButtonGrayed'; + const SUBSTYLE_BgButtonOff = 'BgButtonOff'; + const SUBSTYLE_BgButtonShadow = 'BgButtonShadow'; + const SUBSTYLE_BgButtonSmall = 'BgButtonSmall'; + const SUBSTYLE_BgCard = 'BgCard'; + const SUBSTYLE_BgCard1 = 'BgCard1'; + const SUBSTYLE_BgCard2 = 'BgCard2'; + const SUBSTYLE_BgCard3 = 'BgCard3'; + const SUBSTYLE_BgCardBuddy = 'BgCardBuddy'; + const SUBSTYLE_BgCardChallenge = 'BgCardChallenge'; + const SUBSTYLE_BgCardFolder = 'BgCardFolder'; const SUBSTYLE_BgCardInventoryItem = 'BgCardInventoryItem'; - const SUBSTYLE_BgCardList = 'BgCardList'; - const SUBSTYLE_BgCardOnline = 'BgCardOnline'; - const SUBSTYLE_BgCardPlayer = 'BgCardPlayer'; - const SUBSTYLE_BgCardProperty = 'BgCardProperty'; - const SUBSTYLE_BgCardSystem = 'BgCardSystem'; - const SUBSTYLE_BgCardZone = 'BgCardZone'; - const SUBSTYLE_BgColorContour = 'BgColorContour'; - const SUBSTYLE_BgDialogBlur = 'BgDialogBlur'; - const SUBSTYLE_BgEmpty = 'BgEmpty'; - const SUBSTYLE_BgGradBottom = 'BgGradBottom'; - const SUBSTYLE_BgGradLeft = 'BgGradLeft'; - const SUBSTYLE_BgGradRight = 'BgGradRight'; - const SUBSTYLE_BgGradTop = 'BgGradTop'; - const SUBSTYLE_BgGradV = 'BgGradV'; - const SUBSTYLE_BgHealthBar = 'BgHealthBar'; - const SUBSTYLE_BgIconBorder = 'BgIconBorder'; - const SUBSTYLE_BgList = 'BgList'; - const SUBSTYLE_BgListLine = 'BgListLine'; - const SUBSTYLE_BgPager = 'BgPager'; - const SUBSTYLE_BgProgressBar = 'BgProgressBar'; - const SUBSTYLE_BgShadow = 'BgShadow'; - const SUBSTYLE_BgSlider = 'BgSlider'; - const SUBSTYLE_BgSystemBar = 'BgSystemBar'; - const SUBSTYLE_BgTitle2 = 'BgTitle2'; - const SUBSTYLE_BgTitle3 = 'BgTitle3'; - const SUBSTYLE_BgTitle3_1 = 'BgTitle3_1'; - const SUBSTYLE_BgTitle3_2 = 'BgTitle3_2'; - const SUBSTYLE_BgTitle3_3 = 'BgTitle3_3'; - const SUBSTYLE_BgTitle3_4 = 'BgTitle3_4'; - const SUBSTYLE_BgTitle3_5 = 'BgTitle3_5'; - const SUBSTYLE_BgTitleGlow = 'BgTitleGlow'; - const SUBSTYLE_BgTitlePage = 'BgTitlePage'; - const SUBSTYLE_BgTitleShadow = 'BgTitleShadow'; - const SUBSTYLE_BgWindow1 = 'BgWindow1'; - const SUBSTYLE_BgWindow2 = 'BgWindow2'; - const SUBSTYLE_BgWindow3 = 'BgWindow3'; - const SUBSTYLE_BgWindow4 = 'BgWindow4'; - const SUBSTYLE_EnergyBar = 'EnergyBar'; - const SUBSTYLE_EnergyTeam2 = 'EnergyTeam2'; - const SUBSTYLE_Glow = 'Glow'; - const SUBSTYLE_HealthBar = 'HealthBar'; - const SUBSTYLE_NavButton = 'NavButton'; - const SUBSTYLE_NavButtonBlink = 'NavButtonBlink'; - const SUBSTYLE_NavButtonQuit = 'NavButtonQuit'; - const SUBSTYLE_ProgressBar = 'ProgressBar'; - const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall'; - const SUBSTYLE_Shadow = 'Shadow'; + const SUBSTYLE_BgCardList = 'BgCardList'; + const SUBSTYLE_BgCardOnline = 'BgCardOnline'; + const SUBSTYLE_BgCardPlayer = 'BgCardPlayer'; + const SUBSTYLE_BgCardProperty = 'BgCardProperty'; + const SUBSTYLE_BgCardSystem = 'BgCardSystem'; + const SUBSTYLE_BgCardZone = 'BgCardZone'; + const SUBSTYLE_BgColorContour = 'BgColorContour'; + const SUBSTYLE_BgDialogBlur = 'BgDialogBlur'; + const SUBSTYLE_BgEmpty = 'BgEmpty'; + const SUBSTYLE_BgGradBottom = 'BgGradBottom'; + const SUBSTYLE_BgGradLeft = 'BgGradLeft'; + const SUBSTYLE_BgGradRight = 'BgGradRight'; + const SUBSTYLE_BgGradTop = 'BgGradTop'; + const SUBSTYLE_BgGradV = 'BgGradV'; + const SUBSTYLE_BgHealthBar = 'BgHealthBar'; + const SUBSTYLE_BgIconBorder = 'BgIconBorder'; + const SUBSTYLE_BgList = 'BgList'; + const SUBSTYLE_BgListLine = 'BgListLine'; + const SUBSTYLE_BgPager = 'BgPager'; + const SUBSTYLE_BgProgressBar = 'BgProgressBar'; + const SUBSTYLE_BgShadow = 'BgShadow'; + const SUBSTYLE_BgSlider = 'BgSlider'; + const SUBSTYLE_BgSystemBar = 'BgSystemBar'; + const SUBSTYLE_BgTitle2 = 'BgTitle2'; + const SUBSTYLE_BgTitle3 = 'BgTitle3'; + const SUBSTYLE_BgTitle3_1 = 'BgTitle3_1'; + const SUBSTYLE_BgTitle3_2 = 'BgTitle3_2'; + const SUBSTYLE_BgTitle3_3 = 'BgTitle3_3'; + const SUBSTYLE_BgTitle3_4 = 'BgTitle3_4'; + const SUBSTYLE_BgTitle3_5 = 'BgTitle3_5'; + const SUBSTYLE_BgTitleGlow = 'BgTitleGlow'; + const SUBSTYLE_BgTitlePage = 'BgTitlePage'; + const SUBSTYLE_BgTitleShadow = 'BgTitleShadow'; + const SUBSTYLE_BgWindow1 = 'BgWindow1'; + const SUBSTYLE_BgWindow2 = 'BgWindow2'; + const SUBSTYLE_BgWindow3 = 'BgWindow3'; + const SUBSTYLE_BgWindow4 = 'BgWindow4'; + const SUBSTYLE_EnergyBar = 'EnergyBar'; + const SUBSTYLE_EnergyTeam2 = 'EnergyTeam2'; + const SUBSTYLE_Glow = 'Glow'; + const SUBSTYLE_HealthBar = 'HealthBar'; + const SUBSTYLE_NavButton = 'NavButton'; + const SUBSTYLE_NavButtonBlink = 'NavButtonBlink'; + const SUBSTYLE_NavButtonQuit = 'NavButtonQuit'; + const SUBSTYLE_ProgressBar = 'ProgressBar'; + const SUBSTYLE_ProgressBarSmall = 'ProgressBarSmall'; + const SUBSTYLE_Shadow = 'Shadow'; - /** - * Create a new Quad_Bgs1InRace Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Bgs1InRace + /* + * Protected properties */ - public static function create($id = null) { - $quadBgs1InRace = new Quad_Bgs1InRace($id); - return $quadBgs1InRace; - } - - /** - * Construct a new Quad_Bgs1InRace Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_BgsChallengeMedals.php b/application/core/Libs/FML/Controls/Quads/Quad_BgsChallengeMedals.php index f473a043..b0c9800c 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_BgsChallengeMedals.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_BgsChallengeMedals.php @@ -5,42 +5,26 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'BgsChallengeMedals' Style + * Quad class for 'BgsChallengeMedals' styles * - * @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 Quad_BgsChallengeMedals extends Quad { /* * Constants */ - const STYLE = 'BgsChallengeMedals'; - const SUBSTYLE_BgBronze = 'BgBronze'; - const SUBSTYLE_BgGold = 'BgGold'; - const SUBSTYLE_BgNadeo = 'BgNadeo'; + const STYLE = 'BgsChallengeMedals'; + const SUBSTYLE_BgBronze = 'BgBronze'; + const SUBSTYLE_BgGold = 'BgGold'; + const SUBSTYLE_BgNadeo = 'BgNadeo'; const SUBSTYLE_BgNotPlayed = 'BgNotPlayed'; - const SUBSTYLE_BgPlayed = 'BgPlayed'; - const SUBSTYLE_BgSilver = 'BgSilver'; + const SUBSTYLE_BgPlayed = 'BgPlayed'; + const SUBSTYLE_BgSilver = 'BgSilver'; - /** - * Create a new Quad_BgsChallengeMedals Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_BgsChallengeMedals + /* + * Protected properties */ - public static function create($id = null) { - $quadBgsChallengeMedals = new Quad_BgsChallengeMedals($id); - return $quadBgsChallengeMedals; - } - - /** - * Construct a new Quad_BgsChallengeMedals Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_BgsPlayerCard.php b/application/core/Libs/FML/Controls/Quads/Quad_BgsPlayerCard.php index fe912335..e18612df 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_BgsPlayerCard.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_BgsPlayerCard.php @@ -5,50 +5,34 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'BgsPlayerCard' Style + * Quad class for 'BgsPlayerCard' styles * - * @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 Quad_BgsPlayerCard extends Quad { /* * Constants */ - const STYLE = 'BgsPlayerCard'; - const SUBSTYLE_BgActivePlayerCard = 'BgActivePlayerCard'; - const SUBSTYLE_BgActivePlayerName = 'BgActivePlayerName'; + const STYLE = 'BgsPlayerCard'; + const SUBSTYLE_BgActivePlayerCard = 'BgActivePlayerCard'; + const SUBSTYLE_BgActivePlayerName = 'BgActivePlayerName'; const SUBSTYLE_BgActivePlayerScore = 'BgActivePlayerScore'; - const SUBSTYLE_BgCard = 'BgCard'; - const SUBSTYLE_BgCardSystem = 'BgCardSystem'; - const SUBSTYLE_BgMediaTracker = 'BgMediaTracker'; - const SUBSTYLE_BgPlayerCard = 'BgPlayerCard'; - const SUBSTYLE_BgPlayerCardBig = 'BgPlayerCardBig'; - const SUBSTYLE_BgPlayerCardSmall = 'BgPlayerCardSmall'; - const SUBSTYLE_BgPlayerName = 'BgPlayerName'; - const SUBSTYLE_BgPlayerScore = 'BgPlayerScore'; - const SUBSTYLE_BgRacePlayerLine = 'BgRacePlayerLine'; - const SUBSTYLE_BgRacePlayerName = 'BgRacePlayerName'; - const SUBSTYLE_ProgressBar = 'ProgressBar'; + const SUBSTYLE_BgCard = 'BgCard'; + const SUBSTYLE_BgCardSystem = 'BgCardSystem'; + const SUBSTYLE_BgMediaTracker = 'BgMediaTracker'; + const SUBSTYLE_BgPlayerCard = 'BgPlayerCard'; + const SUBSTYLE_BgPlayerCardBig = 'BgPlayerCardBig'; + const SUBSTYLE_BgPlayerCardSmall = 'BgPlayerCardSmall'; + const SUBSTYLE_BgPlayerName = 'BgPlayerName'; + const SUBSTYLE_BgPlayerScore = 'BgPlayerScore'; + const SUBSTYLE_BgRacePlayerLine = 'BgRacePlayerLine'; + const SUBSTYLE_BgRacePlayerName = 'BgRacePlayerName'; + const SUBSTYLE_ProgressBar = 'ProgressBar'; - /** - * Create a new Quad_BgsPlayerCard Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_BgsPlayerCard + /* + * Protected properties */ - public static function create($id = null) { - $quadBgsPlayerCard = new Quad_BgsPlayerCard($id); - return $quadBgsPlayerCard; - } - - /** - * Construct a new Quad_BgsPlayerCard Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Copilot.php b/application/core/Libs/FML/Controls/Quads/Quad_Copilot.php index 176c2bb7..6e16cc41 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Copilot.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Copilot.php @@ -5,48 +5,32 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Copilot' Style + * Quad class for 'Copilot' styles * - * @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 Quad_Copilot extends Quad { /* * Constants */ - const STYLE = 'Copilot'; - const SUBSTYLE_Down = 'Down'; - const SUBSTYLE_DownGood = 'DownGood'; - const SUBSTYLE_DownWrong = 'DownWrong'; - const SUBSTYLE_Left = 'Left'; - const SUBSTYLE_LeftGood = 'LeftGood'; - const SUBSTYLE_LeftWrong = 'LeftWrong'; - const SUBSTYLE_Right = 'Right'; - const SUBSTYLE_RightGood = 'RightGood'; + const STYLE = 'Copilot'; + const SUBSTYLE_Down = 'Down'; + const SUBSTYLE_DownGood = 'DownGood'; + const SUBSTYLE_DownWrong = 'DownWrong'; + const SUBSTYLE_Left = 'Left'; + const SUBSTYLE_LeftGood = 'LeftGood'; + const SUBSTYLE_LeftWrong = 'LeftWrong'; + const SUBSTYLE_Right = 'Right'; + const SUBSTYLE_RightGood = 'RightGood'; const SUBSTYLE_RightWrong = 'RightWrong'; - const SUBSTYLE_Up = 'Up'; - const SUBSTYLE_UpGood = 'UpGood'; - const SUBSTYLE_UpWrong = 'UpWrong'; + const SUBSTYLE_Up = 'Up'; + const SUBSTYLE_UpGood = 'UpGood'; + const SUBSTYLE_UpWrong = 'UpWrong'; - /** - * Create a new Quad_Copilot Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Copilot + /* + * Protected properties */ - public static function create($id = null) { - $quadCopilot = new Quad_Copilot($id); - return $quadCopilot; - } - - /** - * Construct a new Quad_Copilot Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Emblems.php b/application/core/Libs/FML/Controls/Quads/Quad_Emblems.php index 9a4e0183..2c1d91dd 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Emblems.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Emblems.php @@ -5,39 +5,23 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Emblems' Style + * Quad class for 'Emblems' styles * - * @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 Quad_Emblems extends Quad { /* * Constants */ - const STYLE = 'Emblems'; + const STYLE = 'Emblems'; const SUBSTYLE_0 = '#0'; const SUBSTYLE_1 = '#1'; const SUBSTYLE_2 = '#2'; - /** - * Create a new Quad_Emblems Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Emblems + /* + * Protected properties */ - public static function create($id = null) { - $quadEmblems = new Quad_Emblems($id); - return $quadEmblems; - } - - /** - * Construct a new Quad_Emblems Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_EnergyBar.php b/application/core/Libs/FML/Controls/Quads/Quad_EnergyBar.php index 9c88895e..24433c23 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_EnergyBar.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_EnergyBar.php @@ -5,42 +5,26 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'EnergyBar' Style + * Quad class for 'EnergyBar' styles * - * @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 Quad_EnergyBar extends Quad { /* * Constants */ - const STYLE = 'EnergyBar'; - const SUBSTYLE_BgText = 'BgText'; - const SUBSTYLE_EnergyBar = 'EnergyBar'; - const SUBSTYLE_EnergyBar_0_25 = 'EnergyBar_0.25'; - const SUBSTYLE_EnergyBar_Thin = 'EnergyBar_Thin'; - const SUBSTYLE_HeaderGaugeLeft = 'HeaderGaugeLeft'; + const STYLE = 'EnergyBar'; + const SUBSTYLE_BgText = 'BgText'; + const SUBSTYLE_EnergyBar = 'EnergyBar'; + const SUBSTYLE_EnergyBar_0_25 = 'EnergyBar_0.25'; + const SUBSTYLE_EnergyBar_Thin = 'EnergyBar_Thin'; + const SUBSTYLE_HeaderGaugeLeft = 'HeaderGaugeLeft'; const SUBSTYLE_HeaderGaugeRight = 'HeaderGaugeRight'; - /** - * Create a new Quad_EnergyBar Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_EnergyBar + /* + * Protected properties */ - public static function create($id = null) { - $quadEnergybar = new Quad_EnergyBar($id); - return $quadEnergybar; - } - - /** - * Construct a new Quad_EnergyBar Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Hud3dEchelons.php b/application/core/Libs/FML/Controls/Quads/Quad_Hud3dEchelons.php index e9f0d4bd..994a61e3 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Hud3dEchelons.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Hud3dEchelons.php @@ -5,45 +5,29 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Hud3dEchelons' Style + * Quad class for 'Hud3dEchelons' styles * - * @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 Quad_Hud3dEchelons extends Quad { /* * Constants */ - const STYLE = 'Hud3dEchelons'; + const STYLE = 'Hud3dEchelons'; const SUBSTYLE_EchelonBronze1 = 'EchelonBronze1'; const SUBSTYLE_EchelonBronze2 = 'EchelonBronze2'; const SUBSTYLE_EchelonBronze3 = 'EchelonBronze3'; - const SUBSTYLE_EchelonGold1 = 'EchelonGold1'; - const SUBSTYLE_EchelonGold2 = 'EchelonGold2'; - const SUBSTYLE_EchelonGold3 = 'EchelonGold3'; + const SUBSTYLE_EchelonGold1 = 'EchelonGold1'; + const SUBSTYLE_EchelonGold2 = 'EchelonGold2'; + const SUBSTYLE_EchelonGold3 = 'EchelonGold3'; const SUBSTYLE_EchelonSilver1 = 'EchelonSilver1'; const SUBSTYLE_EchelonSilver2 = 'EchelonSilver2'; const SUBSTYLE_EchelonSilver3 = 'EchelonSilver3'; - /** - * Create a new Quad_Hud3dEchelons Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Hud3dEchelons + /* + * Protected properties */ - public static function create($id = null) { - $quadHud3dEchelons = new Quad_Hud3dEchelons($id); - return $quadHud3dEchelons; - } - - /** - * Construct a new Quad_Hud3dEchelons Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Hud3dIcons.php b/application/core/Libs/FML/Controls/Quads/Quad_Hud3dIcons.php index 963e5431..84bd8801 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Hud3dIcons.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Hud3dIcons.php @@ -5,44 +5,28 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Hud3dIcons' Style + * Quad class for 'Hud3dIcons' styles * - * @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 Quad_Hud3dIcons extends Quad { /* * Constants */ - const STYLE = 'Hud3dIcons'; - const SUBSTYLE_Cross = 'Cross'; + const STYLE = 'Hud3dIcons'; + const SUBSTYLE_Cross = 'Cross'; const SUBSTYLE_CrossTargeted = 'CrossTargeted'; - const SUBSTYLE_Player1 = 'Player1'; - const SUBSTYLE_Player2 = 'Player2'; - const SUBSTYLE_Player3 = 'Player3'; - const SUBSTYLE_PointA = 'PointA'; - const SUBSTYLE_PointB = 'PointB'; - const SUBSTYLE_PointC = 'PointC'; + const SUBSTYLE_Player1 = 'Player1'; + const SUBSTYLE_Player2 = 'Player2'; + const SUBSTYLE_Player3 = 'Player3'; + const SUBSTYLE_PointA = 'PointA'; + const SUBSTYLE_PointB = 'PointB'; + const SUBSTYLE_PointC = 'PointC'; - /** - * Create a new Quad_Hud3dIcons Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Hud3dIcons + /* + * Protected properties */ - public static function create($id = null) { - $quadHud3dIcons = new Quad_Hud3dIcons($id); - return $quadHud3dIcons; - } - - /** - * Construct a new Quad_Hud3dIcons Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Icons128x128_1.php b/application/core/Libs/FML/Controls/Quads/Quad_Icons128x128_1.php index 0e7f2831..7953b336 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Icons128x128_1.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Icons128x128_1.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Icons128x128_1' Style + * Quad class for 'Icons128x128_1' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -81,24 +81,8 @@ class Quad_Icons128x128_1 extends Quad { const SUBSTYLE_Upload = 'Upload'; const SUBSTYLE_Vehicles = 'Vehicles'; - /** - * Create a new Quad_Icons128x128_1 Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Icons128x128_1 + /* + * Protected properties */ - public static function create($id = null) { - $quadIcons128x128_1 = new Quad_Icons128x128_1($id); - return $quadIcons128x128_1; - } - - /** - * Construct a new Quad_Icons128x128_1 Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Icons128x128_Blink.php b/application/core/Libs/FML/Controls/Quads/Quad_Icons128x128_Blink.php index 021801b7..f0c797fe 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Icons128x128_Blink.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Icons128x128_Blink.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Icons128x128_Blink' Style + * Quad class for 'Icons128x128_Blink' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -81,24 +81,8 @@ class Quad_Icons128x128_Blink extends Quad { const SUBSTYLE_Upload = 'Upload'; const SUBSTYLE_Vehicles = 'Vehicles'; - /** - * Create a new Quad_Icons128x128_Blink Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Icons128x128_Blink + /* + * Protected properties */ - public static function create($id = null) { - $quadIcons128x128_Blink = new Quad_Icons128x128_Blink($id); - return $quadIcons128x128_Blink; - } - - /** - * Construct a new Quad_Icons128x128_Blink Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Icons128x32_1.php b/application/core/Libs/FML/Controls/Quads/Quad_Icons128x32_1.php index fcb3e81d..26b23724 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Icons128x32_1.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Icons128x32_1.php @@ -5,62 +5,46 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Icons128x32_1' Style + * Quad class for 'Icons128x32_1' styles * - * @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 Quad_Icons128x32_1 extends Quad { /* * Constants */ - const STYLE = 'Icons128x32_1'; - const SUBSTYLE_Empty = 'Empty'; - const SUBSTYLE_ManiaLinkHome = 'ManiaLinkHome'; + const STYLE = 'Icons128x32_1'; + const SUBSTYLE_Empty = 'Empty'; + const SUBSTYLE_ManiaLinkHome = 'ManiaLinkHome'; const SUBSTYLE_ManiaLinkSwitch = 'ManiaLinkSwitch'; - const SUBSTYLE_ManiaPlanet = 'ManiaPlanet'; - const SUBSTYLE_Minimize = 'Minimize'; - const SUBSTYLE_Music = 'Music'; - const SUBSTYLE_PainterBrush = 'PainterBrush'; - const SUBSTYLE_PainterFill = 'PainterFill'; - const SUBSTYLE_PainterLayer = 'PainterLayer'; - const SUBSTYLE_PainterMirror = 'PainterMirror'; - const SUBSTYLE_PainterSticker = 'PainterSticker'; - const SUBSTYLE_PainterTeam = 'PainterTeam'; - const SUBSTYLE_RT_Cup = 'RT_Cup'; - const SUBSTYLE_RT_Laps = 'RT_Laps'; - const SUBSTYLE_RT_Rounds = 'RT_Rounds'; - const SUBSTYLE_RT_Script = 'RT_Script'; - const SUBSTYLE_RT_Team = 'RT_Team'; - const SUBSTYLE_RT_TimeAttack = 'RT_TimeAttack'; - const SUBSTYLE_RT_Stunts = 'RT_Stunts'; - const SUBSTYLE_Settings = 'Settings'; - const SUBSTYLE_SliderBar = 'SliderBar'; - const SUBSTYLE_SliderBar2 = 'SliderBar2'; - const SUBSTYLE_SliderCursor = 'SliderCursor'; - const SUBSTYLE_Sound = 'Sound'; - const SUBSTYLE_UrlBg = 'UrlBg'; - const SUBSTYLE_Windowed = 'Windowed'; + const SUBSTYLE_ManiaPlanet = 'ManiaPlanet'; + const SUBSTYLE_Minimize = 'Minimize'; + const SUBSTYLE_Music = 'Music'; + const SUBSTYLE_PainterBrush = 'PainterBrush'; + const SUBSTYLE_PainterFill = 'PainterFill'; + const SUBSTYLE_PainterLayer = 'PainterLayer'; + const SUBSTYLE_PainterMirror = 'PainterMirror'; + const SUBSTYLE_PainterSticker = 'PainterSticker'; + const SUBSTYLE_PainterTeam = 'PainterTeam'; + const SUBSTYLE_RT_Cup = 'RT_Cup'; + const SUBSTYLE_RT_Laps = 'RT_Laps'; + const SUBSTYLE_RT_Rounds = 'RT_Rounds'; + const SUBSTYLE_RT_Script = 'RT_Script'; + const SUBSTYLE_RT_Team = 'RT_Team'; + const SUBSTYLE_RT_TimeAttack = 'RT_TimeAttack'; + const SUBSTYLE_RT_Stunts = 'RT_Stunts'; + const SUBSTYLE_Settings = 'Settings'; + const SUBSTYLE_SliderBar = 'SliderBar'; + const SUBSTYLE_SliderBar2 = 'SliderBar2'; + const SUBSTYLE_SliderCursor = 'SliderCursor'; + const SUBSTYLE_Sound = 'Sound'; + const SUBSTYLE_UrlBg = 'UrlBg'; + const SUBSTYLE_Windowed = 'Windowed'; - /** - * Create a new Quad_Icons128x32_1 Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Icons128x32_1 + /* + * Protected properties */ - public static function create($id = null) { - $quadIcons128x32_1 = new Quad_Icons128x32_1($id); - return $quadIcons128x32_1; - } - - /** - * Construct a new Quad_Icons128x32_1 Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Icons64x64_1.php b/application/core/Libs/FML/Controls/Quads/Quad_Icons64x64_1.php index 1398ad3a..1462d947 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Icons64x64_1.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Icons64x64_1.php @@ -5,122 +5,106 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Icons64x64_1' Style + * Quad class for 'Icons64x64_1' styles * - * @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 Quad_Icons64x64_1 extends Quad { /* * Constants */ - const STYLE = 'Icons64x64_1'; - const SUBSTYLE_3DStereo = '3DStereo'; - const SUBSTYLE_Add = 'Add'; - const SUBSTYLE_ArrowBlue = 'ArrowBlue'; - const SUBSTYLE_ArrowDisabled = 'ArrowDisabled'; - const SUBSTYLE_ArrowDown = 'ArrowDown'; - const SUBSTYLE_ArrowFastNext = 'ArrowFastNext'; - const SUBSTYLE_ArrowFastPrev = 'ArrowFastPrev'; - const SUBSTYLE_ArrowFirst = 'ArrowFirst'; - const SUBSTYLE_ArrowGreen = 'ArrowGreen'; - const SUBSTYLE_ArrowLast = 'ArrowLast'; - const SUBSTYLE_ArrowNext = 'ArrowNext'; - const SUBSTYLE_ArrowPrev = 'ArrowPrev'; - const SUBSTYLE_ArrowRed = 'ArrowRed'; - const SUBSTYLE_ArrowUp = 'ArrowUp'; - const SUBSTYLE_Browser = 'Browser'; - const SUBSTYLE_Buddy = 'Buddy'; - const SUBSTYLE_ButtonLeagues = 'ButtonLeagues'; - const SUBSTYLE_Camera = 'Camera'; - const SUBSTYLE_CameraLocal = 'CameraLocal'; - const SUBSTYLE_Check = 'Check'; - const SUBSTYLE_ClipPause = 'ClipPause'; - const SUBSTYLE_ClipPlay = 'ClipPlay'; - const SUBSTYLE_ClipRewind = 'ClipRewind'; - const SUBSTYLE_Close = 'Close'; - const SUBSTYLE_Empty = 'Empty'; - const SUBSTYLE_Finish = 'Finish'; - const SUBSTYLE_FinishGrey = 'FinishGrey'; - const SUBSTYLE_First = 'First'; - const SUBSTYLE_GenericButton = 'GenericButton'; - const SUBSTYLE_Green = 'Green'; - const SUBSTYLE_IconLeaguesLadder = 'IconLeaguesLadder'; - const SUBSTYLE_IconPlayers = 'IconPlayers'; - const SUBSTYLE_IconPlayersLadder = 'IconPlayersLadder'; - const SUBSTYLE_IconServers = 'IconServers'; - const SUBSTYLE_Inbox = 'Inbox'; - const SUBSTYLE_LvlGreen = 'LvlGreen'; - const SUBSTYLE_LvlRed = 'LvlRed'; - const SUBSTYLE_LvlYellow = 'LvlYellow'; - const SUBSTYLE_ManiaLinkNext = 'ManiaLinkNext'; - const SUBSTYLE_ManiaLinkPrev = 'ManiaLinkPrev'; - const SUBSTYLE_Maximize = 'Maximize'; + const STYLE = 'Icons64x64_1'; + const SUBSTYLE_3DStereo = '3DStereo'; + const SUBSTYLE_Add = 'Add'; + const SUBSTYLE_ArrowBlue = 'ArrowBlue'; + const SUBSTYLE_ArrowDisabled = 'ArrowDisabled'; + const SUBSTYLE_ArrowDown = 'ArrowDown'; + const SUBSTYLE_ArrowFastNext = 'ArrowFastNext'; + const SUBSTYLE_ArrowFastPrev = 'ArrowFastPrev'; + const SUBSTYLE_ArrowFirst = 'ArrowFirst'; + const SUBSTYLE_ArrowGreen = 'ArrowGreen'; + const SUBSTYLE_ArrowLast = 'ArrowLast'; + const SUBSTYLE_ArrowNext = 'ArrowNext'; + const SUBSTYLE_ArrowPrev = 'ArrowPrev'; + const SUBSTYLE_ArrowRed = 'ArrowRed'; + const SUBSTYLE_ArrowUp = 'ArrowUp'; + const SUBSTYLE_Browser = 'Browser'; + const SUBSTYLE_Buddy = 'Buddy'; + const SUBSTYLE_ButtonLeagues = 'ButtonLeagues'; + const SUBSTYLE_Camera = 'Camera'; + const SUBSTYLE_CameraLocal = 'CameraLocal'; + const SUBSTYLE_Check = 'Check'; + const SUBSTYLE_ClipPause = 'ClipPause'; + const SUBSTYLE_ClipPlay = 'ClipPlay'; + const SUBSTYLE_ClipRewind = 'ClipRewind'; + const SUBSTYLE_Close = 'Close'; + const SUBSTYLE_Empty = 'Empty'; + const SUBSTYLE_Finish = 'Finish'; + const SUBSTYLE_FinishGrey = 'FinishGrey'; + const SUBSTYLE_First = 'First'; + const SUBSTYLE_GenericButton = 'GenericButton'; + const SUBSTYLE_Green = 'Green'; + const SUBSTYLE_IconLeaguesLadder = 'IconLeaguesLadder'; + const SUBSTYLE_IconPlayers = 'IconPlayers'; + const SUBSTYLE_IconPlayersLadder = 'IconPlayersLadder'; + const SUBSTYLE_IconServers = 'IconServers'; + const SUBSTYLE_Inbox = 'Inbox'; + const SUBSTYLE_LvlGreen = 'LvlGreen'; + const SUBSTYLE_LvlRed = 'LvlRed'; + const SUBSTYLE_LvlYellow = 'LvlYellow'; + const SUBSTYLE_ManiaLinkNext = 'ManiaLinkNext'; + const SUBSTYLE_ManiaLinkPrev = 'ManiaLinkPrev'; + const SUBSTYLE_Maximize = 'Maximize'; const SUBSTYLE_MediaAudioDownloading = 'MediaAudioDownloading'; - const SUBSTYLE_MediaPlay = 'MediaPlay'; - const SUBSTYLE_MediaStop = 'MediaStop'; + const SUBSTYLE_MediaPlay = 'MediaPlay'; + const SUBSTYLE_MediaStop = 'MediaStop'; const SUBSTYLE_MediaVideoDownloading = 'MediaVideoDownloading'; - const SUBSTYLE_NewMessage = 'NewMessage'; - const SUBSTYLE_NotBuddy = 'NotBuddy'; - const SUBSTYLE_OfficialRace = 'OfficialRace'; - const SUBSTYLE_Opponents = 'Opponents'; - const SUBSTYLE_Outbox = 'Outbox'; - const SUBSTYLE_QuitRace = 'QuitRace'; - const SUBSTYLE_RedHigh = 'RedHigh'; - const SUBSTYLE_RedLow = 'RedLow'; - const SUBSTYLE_Refresh = 'Refresh'; - const SUBSTYLE_RestartRace = 'RestartRace'; - const SUBSTYLE_Save = 'Save'; - const SUBSTYLE_Second = 'Second'; - const SUBSTYLE_ShowDown = 'ShowDown'; - const SUBSTYLE_ShowDown2 = 'ShowDown2'; - const SUBSTYLE_ShowLeft = 'ShowLeft'; - const SUBSTYLE_ShowLeft2 = 'ShowLeft2'; - const SUBSTYLE_ShowRight = 'ShowRight'; - const SUBSTYLE_ShowRight2 = 'ShowRight2'; - const SUBSTYLE_ShowUp = 'ShowUp'; - const SUBSTYLE_ShowUp2 = 'ShowUp2'; - const SUBSTYLE_ShowUpChanging = 'ShowUpChanging'; - const SUBSTYLE_SliderCursor = 'SliderCursor'; - const SUBSTYLE_SliderCursor2 = 'SliderCursor2'; - const SUBSTYLE_StateFavourite = 'StateFavourite'; - const SUBSTYLE_StatePrivate = 'StatePrivate'; - const SUBSTYLE_StateSuggested = 'StateSuggested'; - const SUBSTYLE_Sub = 'Sub'; - const SUBSTYLE_TagTypeBronze = 'TagTypeBronze'; - const SUBSTYLE_TagTypeGold = 'TagTypeGold'; - const SUBSTYLE_TagTypeNadeo = 'TagTypeNadeo'; - const SUBSTYLE_TagTypeNone = 'TagTypeNone'; - const SUBSTYLE_TagTypeSilver = 'TagTypeSilver'; - const SUBSTYLE_Third = 'Third'; - const SUBSTYLE_ToolLeague1 = 'ToolLeague1'; - const SUBSTYLE_ToolRoot = 'ToolRoot'; - const SUBSTYLE_ToolTree = 'ToolTree'; - const SUBSTYLE_ToolUp = 'ToolUp'; - const SUBSTYLE_TrackInfo = 'TrackInfo'; - const SUBSTYLE_TV = 'TV'; - const SUBSTYLE_YellowHigh = 'YellowHigh'; - const SUBSTYLE_YellowLow = 'YellowLow'; + const SUBSTYLE_NewMessage = 'NewMessage'; + const SUBSTYLE_NotBuddy = 'NotBuddy'; + const SUBSTYLE_OfficialRace = 'OfficialRace'; + const SUBSTYLE_Opponents = 'Opponents'; + const SUBSTYLE_Outbox = 'Outbox'; + const SUBSTYLE_QuitRace = 'QuitRace'; + const SUBSTYLE_RedHigh = 'RedHigh'; + const SUBSTYLE_RedLow = 'RedLow'; + const SUBSTYLE_Refresh = 'Refresh'; + const SUBSTYLE_RestartRace = 'RestartRace'; + const SUBSTYLE_Save = 'Save'; + const SUBSTYLE_Second = 'Second'; + const SUBSTYLE_ShowDown = 'ShowDown'; + const SUBSTYLE_ShowDown2 = 'ShowDown2'; + const SUBSTYLE_ShowLeft = 'ShowLeft'; + const SUBSTYLE_ShowLeft2 = 'ShowLeft2'; + const SUBSTYLE_ShowRight = 'ShowRight'; + const SUBSTYLE_ShowRight2 = 'ShowRight2'; + const SUBSTYLE_ShowUp = 'ShowUp'; + const SUBSTYLE_ShowUp2 = 'ShowUp2'; + const SUBSTYLE_ShowUpChanging = 'ShowUpChanging'; + const SUBSTYLE_SliderCursor = 'SliderCursor'; + const SUBSTYLE_SliderCursor2 = 'SliderCursor2'; + const SUBSTYLE_StateFavourite = 'StateFavourite'; + const SUBSTYLE_StatePrivate = 'StatePrivate'; + const SUBSTYLE_StateSuggested = 'StateSuggested'; + const SUBSTYLE_Sub = 'Sub'; + const SUBSTYLE_TagTypeBronze = 'TagTypeBronze'; + const SUBSTYLE_TagTypeGold = 'TagTypeGold'; + const SUBSTYLE_TagTypeNadeo = 'TagTypeNadeo'; + const SUBSTYLE_TagTypeNone = 'TagTypeNone'; + const SUBSTYLE_TagTypeSilver = 'TagTypeSilver'; + const SUBSTYLE_Third = 'Third'; + const SUBSTYLE_ToolLeague1 = 'ToolLeague1'; + const SUBSTYLE_ToolRoot = 'ToolRoot'; + const SUBSTYLE_ToolTree = 'ToolTree'; + const SUBSTYLE_ToolUp = 'ToolUp'; + const SUBSTYLE_TrackInfo = 'TrackInfo'; + const SUBSTYLE_TV = 'TV'; + const SUBSTYLE_YellowHigh = 'YellowHigh'; + const SUBSTYLE_YellowLow = 'YellowLow'; - /** - * Create a new Quad_Icons64x64_1 Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Icons64x64_1 + /* + * Protected properties */ - public static function create($id = null) { - $quadIcons64x64_1 = new Quad_Icons64x64_1($id); - return $quadIcons64x64_1; - } - - /** - * Construct a new Quad_Icons64x64_1 Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_Icons64x64_2.php b/application/core/Libs/FML/Controls/Quads/Quad_Icons64x64_2.php index a9a3229f..ac3e3281 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_Icons64x64_2.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_Icons64x64_2.php @@ -5,50 +5,34 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'Icons64x64_2' Style + * Quad class for 'Icons64x64_2' styles * - * @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 Quad_Icons64x64_2 extends Quad { /* * Constants */ - const STYLE = 'Icons64x64_2'; - const SUBSTYLE_ArrowElimination = 'ArrowElimination'; - const SUBSTYLE_ArrowHit = 'ArrowHit'; - const SUBSTYLE_Disconnected = 'Disconnected'; - const SUBSTYLE_DisconnectedLight = 'DisconnectedLight'; - const SUBSTYLE_LaserElimination = 'LaserElimination'; - const SUBSTYLE_LaserHit = 'LaserHit'; + const STYLE = 'Icons64x64_2'; + const SUBSTYLE_ArrowElimination = 'ArrowElimination'; + const SUBSTYLE_ArrowHit = 'ArrowHit'; + const SUBSTYLE_Disconnected = 'Disconnected'; + const SUBSTYLE_DisconnectedLight = 'DisconnectedLight'; + const SUBSTYLE_LaserElimination = 'LaserElimination'; + const SUBSTYLE_LaserHit = 'LaserHit'; const SUBSTYLE_NucleusElimination = 'NucleusElimination'; - const SUBSTYLE_NucleusHit = 'NucleusHit'; - const SUBSTYLE_RocketElimination = 'RocketElimination'; - const SUBSTYLE_RocketHit = 'RocketHit'; - const SUBSTYLE_ServerNotice = 'ServerNotice'; - const SUBSTYLE_SortBy = 'SortBy'; + const SUBSTYLE_NucleusHit = 'NucleusHit'; + const SUBSTYLE_RocketElimination = 'RocketElimination'; + const SUBSTYLE_RocketHit = 'RocketHit'; + const SUBSTYLE_ServerNotice = 'ServerNotice'; + const SUBSTYLE_SortBy = 'SortBy'; const SUBSTYLE_UnknownElimination = 'UnknownElimination'; - const SUBSTYLE_UnknownHit = 'UnknownHit'; + const SUBSTYLE_UnknownHit = 'UnknownHit'; - /** - * Create a new Quad_Icons64x64_2 Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_Icons64x64_2 + /* + * Protected properties */ - public static function create($id = null) { - $quadIcons64x64_2 = new Quad_Icons64x64_2($id); - return $quadIcons64x64_2; - } - - /** - * Construct a new Quad_Icons64x64_2 Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_ManiaPlanetLogos.php b/application/core/Libs/FML/Controls/Quads/Quad_ManiaPlanetLogos.php index 1b8a609d..5ed4b67c 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_ManiaPlanetLogos.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_ManiaPlanetLogos.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'ManiaPlanetLogos' Style + * Quad class for 'ManiaPlanetLogos' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -24,24 +24,8 @@ class Quad_ManiaPlanetLogos extends Quad { const SUBSTYLE_ManiaPlanetLogoWhite = 'ManiaPlanetLogoWhite'; const SUBSTYLE_ManiaPlanetLogoWhiteSmall = 'ManiaPlanetLogoWhiteSmall'; - /** - * Create a new Quad_ManiaPlanetLogos Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_ManiaPlanetLogos + /* + * Protected properties */ - public static function create($id = null) { - $quadManiaPlanetLogos = new Quad_ManiaPlanetLogos($id); - return $quadManiaPlanetLogos; - } - - /** - * Construct a new Quad_ManiaPlanetLogos Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_ManiaPlanetMainMenu.php b/application/core/Libs/FML/Controls/Quads/Quad_ManiaPlanetMainMenu.php index c77acaf1..abf750bd 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_ManiaPlanetMainMenu.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_ManiaPlanetMainMenu.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'ManiaPlanetMainMenu' Style + * Quad class for 'ManiaPlanetMainMenu' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -28,24 +28,8 @@ class Quad_ManiaPlanetMainMenu extends Quad { const SUBSTYLE_TitleBg = 'TitleBg'; const SUBSTYLE_TopBar = 'TopBar'; - /** - * Create a new Quad_ManiaPlanetMainMenu Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_ManiaPlanetMainMenu + /* + * Protected properties */ - public static function create($id = null) { - $quadManiaPlanetMainMenu = new Quad_ManiaPlanetMainMenu($id); - return $quadManiaPlanetMainMenu; - } - - /** - * Construct a new Quad_ManiaPlanetMainMenu Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_ManiaplanetSystem.php b/application/core/Libs/FML/Controls/Quads/Quad_ManiaplanetSystem.php index fd456606..82d3fb29 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_ManiaplanetSystem.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_ManiaplanetSystem.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'ManiaplanetSystem' Style + * Quad class for 'ManiaplanetSystem' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -23,24 +23,8 @@ class Quad_ManiaplanetSystem extends Quad { const SUBSTYLE_Medals = 'Medals'; const SUBSTYLE_Statistics = 'Statistics'; - /** - * Create a new Quad_ManiaplanetSystem Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_ManiaplanetSystem + /* + * Protected properties */ - public static function create($id = null) { - $quadManiaplanetSystem = new Quad_ManiaplanetSystem($id); - return $quadManiaplanetSystem; - } - - /** - * Construct a new Quad_ManiaplanetSystem Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_MedalsBig.php b/application/core/Libs/FML/Controls/Quads/Quad_MedalsBig.php index 508b708d..1628ecbe 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_MedalsBig.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_MedalsBig.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'MedalsBig' Style + * Quad class for 'MedalsBig' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -24,24 +24,8 @@ class Quad_MedalsBig extends Quad { const SUBSTYLE_MedalSilver = 'MedalSilver'; const SUBSTYLE_MedalSlot = 'MedalSlot'; - /** - * Create a new Quad_MedalsBig Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_MedalsBig + /* + * Protected properties */ - public static function create($id = null) { - $quadMedalsBig = new Quad_MedalsBig($id); - return $quadMedalsBig; - } - - /** - * Construct a new Quad_MedalsBig Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_TitleLogos.php b/application/core/Libs/FML/Controls/Quads/Quad_TitleLogos.php index 77e03300..f97fb628 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_TitleLogos.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_TitleLogos.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'TitleLogos' Style + * Quad class for 'TitleLogos' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -21,24 +21,8 @@ class Quad_TitleLogos extends Quad { const SUBSTYLE_Icon = 'Icon'; const SUBSTYLE_Title = 'Title'; - /** - * Create a new Quad_TitleLogos Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_TitleLogos + /* + * Protected properties */ - public static function create($id = null) { - $quadTitleLogos = new Quad_TitleLogos($id); - return $quadTitleLogos; - } - - /** - * Construct a new Quad_TitleLogos Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_UIConstruction_Buttons.php b/application/core/Libs/FML/Controls/Quads/Quad_UIConstruction_Buttons.php index f4156d98..c61595d0 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_UIConstruction_Buttons.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_UIConstruction_Buttons.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'UIConstruction_Buttons' Style + * Quad class for 'UIConstruction_Buttons' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -73,24 +73,8 @@ class Quad_UIConstruction_Buttons extends Quad { const SUBSTYLE_Validate_Step2 = 'Validate_Step2'; const SUBSTYLE_Validate_Step3 = 'Validate_Step3'; - /** - * Create a new Quad_UIConstruction_Buttons Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_UIConstruction_Buttons + /* + * Protected properties */ - public static function create($id = null) { - $quadUIConstructionButtons = new Quad_UIConstruction_Buttons($id); - return $quadUIConstructionButtons; - } - - /** - * Construct a new Quad_UIConstruction_Buttons Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_UIConstruction_Buttons2.php b/application/core/Libs/FML/Controls/Quads/Quad_UIConstruction_Buttons2.php index 53a884c5..f9249629 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_UIConstruction_Buttons2.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_UIConstruction_Buttons2.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'UIConstruction_Buttons2' Style + * Quad class for 'UIConstruction_Buttons2' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -29,24 +29,8 @@ class Quad_UIConstruction_Buttons2 extends Quad { const SUBSTYLE_Open = 'Open'; const SUBSTYLE_Symmetry = 'Symmetry'; - /** - * Create a new Quad_UIConstruction_Buttons2 Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_UIConstruction_Buttons2 + /* + * Protected properties */ - public static function create($id = null) { - $quadUIConstructionButtons2 = new Quad_UIConstruction_Buttons2($id); - return $quadUIConstructionButtons2; - } - - /** - * Construct a new Quad_UIConstruction_Buttons2 Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Quads/Quad_UiSMSpectatorScoreBig.php b/application/core/Libs/FML/Controls/Quads/Quad_UiSMSpectatorScoreBig.php index 7f0ad8c0..1852184e 100644 --- a/application/core/Libs/FML/Controls/Quads/Quad_UiSMSpectatorScoreBig.php +++ b/application/core/Libs/FML/Controls/Quads/Quad_UiSMSpectatorScoreBig.php @@ -5,7 +5,7 @@ namespace FML\Controls\Quads; use FML\Controls\Quad; /** - * Quad Class for 'UiSMSpectatorScoreBig' Style + * Quad class for 'UiSMSpectatorScoreBig' styles * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -38,24 +38,8 @@ class Quad_UiSMSpectatorScoreBig extends Quad { CONST SUBSTYLE_UIRange1Bg = 'UIRange1Bg'; CONST SUBSTYLE_UIRange2Bg = 'UIRange2Bg'; - /** - * Create a new Quad_UiSMSpectatorScoreBig Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Quads\Quad_UiSMSpectatorScoreBig + /* + * Protected properties */ - public static function create($id = null) { - $quadUiSMSpectatorScoreBig = new Quad_UiSMSpectatorScoreBig($id); - return $quadUiSMSpectatorScoreBig; - } - - /** - * Construct a new Quad_UiSMSpectatorScoreBig Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->setStyle(self::STYLE); - } + protected $style = self::STYLE; } diff --git a/application/core/Libs/FML/Controls/Video.php b/application/core/Libs/FML/Controls/Video.php index 3677e80d..94f94bdd 100644 --- a/application/core/Libs/FML/Controls/Video.php +++ b/application/core/Libs/FML/Controls/Video.php @@ -15,36 +15,16 @@ use FML\Types\Scriptable; */ class Video extends Control implements Playable, Scriptable { /* - * Protected Properties + * Protected properties */ - protected $data = ''; - protected $dataId = ''; - protected $play = 0; - protected $looping = 0; - protected $music = 0; + protected $tagName = 'video'; + protected $data = null; + protected $dataId = null; + protected $play = null; + protected $looping = true; + protected $music = null; protected $volume = 1.; - protected $scriptEvents = 0; - - /** - * Construct a new Video Control - * - * @param string $id (optional) Control Id - */ - public function __construct($id = null) { - parent::__construct($id); - $this->tagName = 'video'; - } - - /** - * Create a new Video Control - * - * @param string $id (optional) Control Id - * @return \FML\Controls\Video - */ - public static function create($id = null) { - $video = new Video($id); - return $video; - } + protected $scriptEvents = null; /** * @see \FML\Controls\Control::getManiaScriptClass() @@ -110,7 +90,7 @@ class Video extends Control implements Playable, Scriptable { } /** - * @see \FML\Control::render() + * @see \FML\Types\Renderable::render() */ public function render(\DOMDocument $domDocument) { $xmlElement = parent::render($domDocument); diff --git a/application/core/Libs/FML/CustomUI.php b/application/core/Libs/FML/CustomUI.php index 9b6ffac0..e54ec9cc 100644 --- a/application/core/Libs/FML/CustomUI.php +++ b/application/core/Libs/FML/CustomUI.php @@ -11,7 +11,7 @@ namespace FML; */ class CustomUI { /* - * Protected Properties + * Protected properties */ protected $encoding = 'utf-8'; protected $tagName = 'custom_ui'; @@ -25,26 +25,19 @@ class CustomUI { protected $globalVisible = null; /** - * Create a new CustomUI Object + * Create a new CustomUI object * - * @return \FML\CustomUI + * @return \FML\CustomUI|static */ public static function create() { - $customUI = new CustomUI(); - return $customUI; + return new static(); } /** - * Construct a new CustomUI Object - */ - public function __construct() { - } - - /** - * Set XML Encoding + * Set XML encoding * - * @param string $encoding XML Encoding - * @return \FML\CustomUI + * @param string $encoding XML encoding + * @return \FML\CustomUI|static */ public function setXMLEncoding($encoding) { $this->encoding = (string)$encoding; @@ -52,10 +45,10 @@ class CustomUI { } /** - * Set Showing of Notices + * Set showing of notices * - * @param bool $visible Whether Notices should be shown - * @return \FML\CustomUI + * @param bool $visible Whether notices should be shown + * @return \FML\CustomUI|static */ public function setNoticeVisible($visible) { $this->noticeVisible = $visible; @@ -63,10 +56,10 @@ class CustomUI { } /** - * Set Showing of the Challenge Info + * Set showing of the challenge info * - * @param bool $visible Whether the Challenge Info should be shown - * @return \FML\CustomUI + * @param bool $visible Whether the challenge info should be shown + * @return \FML\CustomUI|static */ public function setChallengeInfoVisible($visible) { $this->challengeInfoVisible = $visible; @@ -74,10 +67,10 @@ class CustomUI { } /** - * Set Showing of the Net Infos + * Set showing of the net infos * - * @param bool $visible Whether the Net Infos should be shown - * @return \FML\CustomUI + * @param bool $visible Whether the net infos should be shown + * @return \FML\CustomUI|static */ public function setNetInfosVisible($visible) { $this->netInfosVisible = $visible; @@ -85,10 +78,10 @@ class CustomUI { } /** - * Set Showing of the Chat + * Set showing of the chat * - * @param bool $visible Whether the Chat should be shown - * @return \FML\CustomUI + * @param bool $visible Whether the chat should be shown + * @return \FML\CustomUI|static */ public function setChatVisible($visible) { $this->chatVisible = $visible; @@ -96,10 +89,10 @@ class CustomUI { } /** - * Set Showing of the Checkpoint List + * Set showing of the checkpoint list * - * @param bool $visible Whether the Checkpoint should be shown - * @return \FML\CustomUI + * @param bool $visible Whether the checkpoint should be shown + * @return \FML\CustomUI|static */ public function setCheckpointListVisible($visible) { $this->checkpointListVisible = $visible; @@ -107,10 +100,10 @@ class CustomUI { } /** - * Set Showing of Round Scores + * Set showing of round scores * - * @param bool $visible Whether the Round Scores should be shown - * @return \FML\CustomUI + * @param bool $visible Whether the round scores should be shown + * @return \FML\CustomUI|static */ public function setRoundScoresVisible($visible) { $this->roundScoresVisible = $visible; @@ -118,10 +111,10 @@ class CustomUI { } /** - * Set Showing of the Scoretable + * Set showing of the scoretable * - * @param bool $visible Whether the Scoretable should be shown - * @return \FML\CustomUI + * @param bool $visible Whether the scoretable should be shown + * @return \FML\CustomUI|static */ public function setScoretableVisible($visible) { $this->scoretableVisible = $visible; @@ -129,10 +122,10 @@ class CustomUI { } /** - * Set Global Showing + * Set global showing * * @param bool $visible Whether the UI should be disabled completely - * @return \FML\CustomUI + * @return \FML\CustomUI|static */ public function setGlobalVisible($visible) { $this->globalVisible = $visible; @@ -140,9 +133,9 @@ class CustomUI { } /** - * Render the XML Document + * Render the XML document * - * @param \DOMDocument $domDocument (optional) DomDocument for which the XML Element should be rendered + * @param \DOMDocument $domDocument (optional) DOMDocument for which the XML element should be rendered * @return \DOMDocument */ public function render($domDocument = null) { @@ -157,7 +150,7 @@ class CustomUI { } $settings = $this->getSettings(); foreach ($settings as $setting => $value) { - if ($value === null) { + if (is_null($value)) { continue; } $xmlSubElement = $domDocument->createElement($setting); @@ -171,18 +164,16 @@ class CustomUI { } /** - * Get String Representation + * Get string representation * * @return string */ public function __toString() { - $domDocument = $this->render(); - $xmlText = $domDocument->saveXML(); - return $xmlText; + return $this->render()->saveXML(); } /** - * Get associative Array of all CustomUI Settings + * Get associative array of all CustomUI settings * * @return array */ diff --git a/application/core/Libs/FML/Elements/Dico.php b/application/core/Libs/FML/Elements/Dico.php index f3d739bd..4196c782 100644 --- a/application/core/Libs/FML/Elements/Dico.php +++ b/application/core/Libs/FML/Elements/Dico.php @@ -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) { diff --git a/application/core/Libs/FML/Elements/Format.php b/application/core/Libs/FML/Elements/Format.php index 19023f10..70d3fc5e 100644 --- a/application/core/Libs/FML/Elements/Format.php +++ b/application/core/Libs/FML/Elements/Format.php @@ -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(); } /** diff --git a/application/core/Libs/FML/Elements/FrameModel.php b/application/core/Libs/FML/Elements/FrameModel.php index 4283a245..ce012bd4 100644 --- a/application/core/Libs/FML/Elements/FrameModel.php +++ b/application/core/Libs/FML/Elements/FrameModel.php @@ -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); } diff --git a/application/core/Libs/FML/Elements/Including.php b/application/core/Libs/FML/Elements/Including.php index 49d3cdf4..f8f79215 100644 --- a/application/core/Libs/FML/Elements/Including.php +++ b/application/core/Libs/FML/Elements/Including.php @@ -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; } /** diff --git a/application/core/Libs/FML/Elements/Music.php b/application/core/Libs/FML/Elements/Music.php index e48ddcab..b3a8ac03 100644 --- a/application/core/Libs/FML/Elements/Music.php +++ b/application/core/Libs/FML/Elements/Music.php @@ -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; diff --git a/application/core/Libs/FML/Elements/SimpleScript.php b/application/core/Libs/FML/Elements/SimpleScript.php index af5b7562..7190bf03 100644 --- a/application/core/Libs/FML/Elements/SimpleScript.php +++ b/application/core/Libs/FML/Elements/SimpleScript.php @@ -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 * @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; diff --git a/application/core/Libs/FML/ManiaCode.php b/application/core/Libs/FML/ManiaCode.php index 89f9e0b3..2428fc98 100644 --- a/application/core/Libs/FML/ManiaCode.php +++ b/application/core/Libs/FML/ManiaCode.php @@ -28,34 +28,28 @@ use FML\ManiaCode\ViewReplay; */ class ManiaCode { /* - * Protected Properties + * Protected properties */ protected $encoding = 'utf-8'; protected $tagName = 'maniacode'; protected $noConfirmation = null; + /** @var Element[] $elements */ protected $elements = array(); /** - * Create a new ManiaCode Object + * Create a new ManiaCode object * - * @return \FML\ManiaCode + * @return \FML\ManiaCode|static */ public static function create() { - $maniaCode = new ManiaCode(); - return $maniaCode; + return new static(); } /** - * Construct a new ManiaCode Object - */ - public function __construct() { - } - - /** - * Set XML Encoding + * Set XML encoding * - * @param string $encoding XML Encoding - * @return \FML\ManiaCode + * @param string $encoding XML encoding + * @return \FML\ManiaCode|static */ public function setXmlEncoding($encoding) { $this->encoding = (string)$encoding; @@ -63,10 +57,10 @@ class ManiaCode { } /** - * Disable the Showing of the Confirmation at the End of the ManiaCode + * Disable the showing of the confirmation at the end of the ManiaCode * - * @param bool $disable Whether the Confirmation should be shown - * @return \FML\ManiaCode + * @param bool $disable Whether the confirmation should be shown + * @return \FML\ManiaCode|static */ public function disableConfirmation($disable) { $this->noConfirmation = ($disable ? 1 : 0); @@ -74,10 +68,10 @@ class ManiaCode { } /** - * Show a Message + * Show a message * - * @param string $message Message Text - * @return \FML\ManiaCode + * @param string $message Message text + * @return \FML\ManiaCode|static */ public function addShowMessage($message) { $messageElement = new ShowMessage($message); @@ -88,10 +82,10 @@ class ManiaCode { /** * Install a Macroblock * - * @param string $name Macroblock Name - * @param string $file Macroblock File - * @param string $url Macroblock Url - * @return \FML\ManiaCode + * @param string $name Macroblock name + * @param string $file Macroblock file + * @param string $url Macroblock url + * @return \FML\ManiaCode|static */ public function addInstallMacroblock($name, $file, $url) { $macroblockElement = new InstallMacroblock($name, $file, $url); @@ -100,11 +94,11 @@ class ManiaCode { } /** - * Install a Map + * Install a map * - * @param string $name Map Name - * @param string $url Map Url - * @return \FML\ManiaCode + * @param string $name Map name + * @param string $url Map url + * @return \FML\ManiaCode|static */ public function addInstallMap($name, $url) { $mapElement = new InstallMap($name, $url); @@ -113,11 +107,11 @@ class ManiaCode { } /** - * Play a Map + * Play a map * - * @param string $name Map Name - * @param string $url Map Url - * @return \FML\ManiaCode + * @param string $name Map name + * @param string $url Map url + * @return \FML\ManiaCode|static */ public function addPlayMap($name, $url) { $mapElement = new PlayMap($name, $url); @@ -126,11 +120,11 @@ class ManiaCode { } /** - * Install a Replay + * Install a replay * - * @param string $name Replay Name - * @param string $url Replay Url - * @return \FML\ManiaCode + * @param string $name Replay name + * @param string $url Replay url + * @return \FML\ManiaCode|static */ public function addInstallReplay($name, $url) { $replayElement = new InstallReplay($name, $url); @@ -139,11 +133,11 @@ class ManiaCode { } /** - * View a Replay + * View a replay * - * @param string $name Replay Name - * @param string $url Replay Url - * @return \FML\ManiaCode + * @param string $name Replay name + * @param string $url Replay url + * @return \FML\ManiaCode|static */ public function addViewReplay($name, $url) { $replayElement = new ViewReplay($name, $url); @@ -152,11 +146,11 @@ class ManiaCode { } /** - * Play a Replay + * Play a replay * - * @param string $name Replay Name - * @param string $url Replay Url - * @return \FML\ManiaCode + * @param string $name Replay name + * @param string $url Replay url + * @return \FML\ManiaCode|static */ public function addPlayReplay($name, $url) { $replayElement = new PlayReplay($name, $url); @@ -165,12 +159,12 @@ class ManiaCode { } /** - * Install a Skin + * Install a skin * - * @param string $name Skin Name - * @param string $file Skin File - * @param string $url Skin Url - * @return \FML\ManiaCode + * @param string $name Skin name + * @param string $file Skin file + * @param string $url Skin url + * @return \FML\ManiaCode|static */ public function addInstallSkin($name, $file, $url) { $skinElement = new InstallSkin($name, $file, $url); @@ -179,12 +173,12 @@ class ManiaCode { } /** - * Get a Skin + * Get a skin * - * @param string $name Skin Name - * @param string $file Skin File - * @param string $url Skin Url - * @return \FML\ManiaCode + * @param string $name Skin name + * @param string $file Skin file + * @param string $url Skin url + * @return \FML\ManiaCode|static */ public function addGetSkin($name, $file, $url) { $skinElement = new GetSkin($name, $file, $url); @@ -193,10 +187,10 @@ class ManiaCode { } /** - * Add a Buddy + * Add a buddy * - * @param string $login Buddy Login - * @return \FML\ManiaCode + * @param string $login Buddy login + * @return \FML\ManiaCode|static */ public function addAddBuddy($login) { $buddyElement = new AddBuddy($login); @@ -205,10 +199,10 @@ class ManiaCode { } /** - * Go to a Link + * Go to a link * - * @param string $link Goto Link - * @return \FML\ManiaCode + * @param string $link Goto link + * @return \FML\ManiaCode|static */ public function addGoto($link) { $gotoElement = new Go_To($link); @@ -217,10 +211,10 @@ class ManiaCode { } /** - * Join a Server + * Join a server * - * @param string $login Server Login - * @return \FML\ManiaCode + * @param string $login Server login + * @return \FML\ManiaCode|static */ public function addJoinServer($login) { $serverElement = new JoinServer($login); @@ -229,10 +223,10 @@ class ManiaCode { } /** - * Add a Server as Favorite + * Add a server as favorite * - * @param string $login Server Login - * @return \FML\ManiaCode + * @param string $login Server login + * @return \FML\ManiaCode|static */ public function addAddFavorite($login) { $favoriteElement = new AddFavorite($login); @@ -241,12 +235,12 @@ class ManiaCode { } /** - * Install a Script + * Install a script * - * @param string $name Script Name - * @param string $file Script File - * @param string $url Script Url - * @return \FML\ManiaCode + * @param string $name Script name + * @param string $file Script file + * @param string $url Script url + * @return \FML\ManiaCode|static */ public function addInstallScript($name, $file, $url) { $scriptElement = new InstallScript($name, $file, $url); @@ -255,12 +249,12 @@ class ManiaCode { } /** - * Install a Title Pack + * Install a title pack * - * @param string $name Pack Name - * @param string $file Pack File - * @param string $url Pack Url - * @return \FML\ManiaCode + * @param string $name Pack name + * @param string $file Pack file + * @param string $url Pack url + * @return \FML\ManiaCode|static */ public function addInstallPack($name, $file, $url) { $packElement = new InstallPack($name, $file, $url); @@ -269,10 +263,10 @@ class ManiaCode { } /** - * Add a ManiaCode Element + * Add a ManiaCode element * - * @param Element $element The Element to add - * @return \FML\ManiaCode + * @param Element $element Element to add + * @return \FML\ManiaCode|static */ public function addElement(Element $element) { array_push($this->elements, $element); @@ -280,9 +274,9 @@ class ManiaCode { } /** - * Removes all Elements from the ManiaCode + * Remove all elements from the ManiaCode * - * @return \FML\ManiaCode + * @return \FML\ManiaCode|static */ public function removeElements() { $this->elements = array(); @@ -290,9 +284,9 @@ class ManiaCode { } /** - * Render the XML Document + * Render the XML document * - * @param bool (optional) $echo Whether the XML Text should be echoed and the Content-Type Header should be set + * @param bool $echo (optional) Whether the XML text should be echoed and the Content-Type header should be set * @return \DOMDocument */ public function render($echo = false) { @@ -304,7 +298,6 @@ class ManiaCode { $maniaCode->setAttribute('noconfirmation', $this->noConfirmation); } foreach ($this->elements as $element) { - /** @var Element $element */ $xmlElement = $element->render($domDocument); $maniaCode->appendChild($xmlElement); } @@ -316,13 +309,11 @@ class ManiaCode { } /** - * Get String Representation + * Get string representation * * @return string */ public function __toString() { - $domDocument = $this->render(); - $xmlText = $domDocument->saveXML(); - return $xmlText; + return $this->render()->saveXML(); } } diff --git a/application/core/Libs/FML/ManiaCode/AddBuddy.php b/application/core/Libs/FML/ManiaCode/AddBuddy.php index 0a3f8852..1e8be821 100644 --- a/application/core/Libs/FML/ManiaCode/AddBuddy.php +++ b/application/core/Libs/FML/ManiaCode/AddBuddy.php @@ -3,58 +3,56 @@ namespace FML\ManiaCode; /** - * ManiaCode Element adding a Buddy + * ManiaCode Element adding a buddy * - * @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 AddBuddy implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'add_buddy'; - protected $login = ''; + protected $login = null; /** - * Construct a new AddBuddy Element + * Create a new AddBuddy Element * - * @param string $login (optional) Buddy Login - * @return \FML\ManiaCode\AddBuddy + * @param string $login (optional) Buddy login + * @return \FML\ManiaCode\AddBuddy|static */ public static function create($login = null) { - $addBuddy = new AddBuddy($login); - return $addBuddy; + return new static($login); } /** * Construct a new AddBuddy Element * - * @param string $login (optional) Buddy Login + * @param string $login (optional) Buddy login */ public function __construct($login = null) { - if ($login !== null) { + if (!is_null($login)) { $this->setLogin($login); } } /** - * Set the Buddy Login + * Set the buddy login * - * @param string $login Buddy Login - * @return \FML\ManiaCode\AddBuddy + * @param string $login Buddy login + * @return \FML\ManiaCode\AddBuddy|static */ public function setLogin($login) { - $this->login = (string) $login; + $this->login = (string)$login; return $this; } /** - * * @see \FML\ManiaCode\Element::render() */ public function render(\DOMDocument $domDocument) { - $xmlElement = $domDocument->createElement($this->tagName); + $xmlElement = $domDocument->createElement($this->tagName); $loginElement = $domDocument->createElement('login', $this->login); $xmlElement->appendChild($loginElement); return $xmlElement; diff --git a/application/core/Libs/FML/ManiaCode/AddFavorite.php b/application/core/Libs/FML/ManiaCode/AddFavorite.php index 651599cb..99f6f072 100644 --- a/application/core/Libs/FML/ManiaCode/AddFavorite.php +++ b/application/core/Libs/FML/ManiaCode/AddFavorite.php @@ -3,82 +3,79 @@ namespace FML\ManiaCode; /** - * ManiaCode Element adding a Server as Favorite + * ManiaCode Element adding a server as favorite * - * @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 AddFavorite implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'add_favourite'; - protected $login = ''; - protected $ip = null; - protected $port = null; + protected $login = null; + protected $serverIp = null; + protected $serverPort = null; /** - * Construct a new AddFavorite Element + * Create a new AddFavorite object * - * @param string $login (optional) Server Login - * @return \FML\ManiaCode\AddFavorite + * @param string $login (optional) Server login + * @return \FML\ManiaCode\AddFavorite|static */ public static function create($login = null) { - $addFavorite = new AddFavorite($login); - return $addFavorite; + return new static($login); } /** - * Construct a new AddFavorite Element + * Construct a new AddFavorite object * - * @param string $login (optional) Server Login + * @param string $login (optional) Server login */ public function __construct($login = null) { - if ($login !== null) { + if (!is_null($login)) { $this->setLogin($login); } } /** - * Set the Server Login + * Set the server login * - * @param string $login Server Login - * @return \FML\ManiaCode\AddFavorite + * @param string $login Server login + * @return \FML\ManiaCode\AddFavorite|static */ public function setLogin($login) { - $this->login = (string) $login; - $this->ip = null; - $this->port = null; + $this->login = (string)$login; + $this->serverIp = null; + $this->serverPort = null; return $this; } /** - * Set the Server Ip and Port + * Set the server ip and port * - * @param string $ip Server Ip - * @param int $port Server Port - * @return \FML\ManiaCode\AddFavorite + * @param string $serverIp Server ip + * @param int $serverPort Server port + * @return \FML\ManiaCode\AddFavorite|static */ - public function setIp($ip, $port) { - $this->ip = (string) $ip; - $this->port = (int) $port; - $this->login = null; + public function setIp($serverIp, $serverPort) { + $this->serverIp = (string)$serverIp; + $this->serverPort = (int)$serverPort; + $this->login = null; return $this; } /** - * * @see \FML\ManiaCode\Element::render() */ public function render(\DOMDocument $domDocument) { $xmlElement = $domDocument->createElement($this->tagName); - if ($this->ip === null) { + if (is_null($this->serverIp)) { $loginElement = $domDocument->createElement('login', $this->login); $xmlElement->appendChild($loginElement); - } - else { - $ipElement = $domDocument->createElement('ip', $this->ip . ':' . $this->port); + } else { + $ipElement = $domDocument->createElement('ip', $this->serverIp . ':' . $this->serverPort); $xmlElement->appendChild($ipElement); } return $xmlElement; diff --git a/application/core/Libs/FML/ManiaCode/Element.php b/application/core/Libs/FML/ManiaCode/Element.php index c443f3c9..3c2cd26e 100644 --- a/application/core/Libs/FML/ManiaCode/Element.php +++ b/application/core/Libs/FML/ManiaCode/Element.php @@ -5,16 +5,16 @@ namespace FML\ManiaCode; /** * Base ManiaCode 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 */ interface Element { /** * Render the ManiaCode Element * - * @param \DOMDocument $domDocument The DomDocument for which the Element should be rendered + * @param \DOMDocument $domDocument The DOMDocument for which the Element should be rendered * @return \DOMElement */ public function render(\DOMDocument $domDocument); diff --git a/application/core/Libs/FML/ManiaCode/GetSkin.php b/application/core/Libs/FML/ManiaCode/GetSkin.php index 66ac6268..028b8c3b 100644 --- a/application/core/Libs/FML/ManiaCode/GetSkin.php +++ b/application/core/Libs/FML/ManiaCode/GetSkin.php @@ -3,92 +3,90 @@ namespace FML\ManiaCode; /** - * ManiaCode Element downloading a Skin + * ManiaCode Element downloading a skin * - * @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 GetSkin implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'get_skin'; - protected $name = ''; - protected $file = ''; - protected $url = ''; + protected $name = null; + protected $file = null; + protected $url = null; /** - * Create a new GetSkin Element + * Create a new GetSkin object * - * @param string $name (optional) Skin Name - * @param string $file (optional) Skin File - * @param string $url (optional) Skin Url - * @return \FML\ManiaCode\GetSkin + * @param string $name (optional) Skin name + * @param string $file (optional) Skin file + * @param string $url (optional) Skin url + * @return \FML\ManiaCode\GetSkin|static */ public static function create($name = null, $file = null, $url = null) { - $getSkin = new GetSkin($name, $file, $url); - return $getSkin; + return new static($name, $file, $url); } /** - * Construct a new GetSkin Element + * Construct a new GetSkin object * - * @param string $name (optional) Skin Name - * @param string $file (optional) Skin File - * @param string $url (optional) Skin Url + * @param string $name (optional) Skin name + * @param string $file (optional) Skin file + * @param string $url (optional) Skin url */ public function __construct($name = null, $file = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($file !== null) { + if (!is_null($file)) { $this->setFile($file); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Skin + * Set the name of the skin * - * @param string $name Skin Name - * @return \FML\ManiaCode\GetSkin + * @param string $name Skin name + * @return \FML\ManiaCode\GetSkin|static */ public function setName($name) { - $this->name = (string) $name; + $this->name = (string)$name; return $this; } /** - * Set the File of the Skin + * Set the file of the skin * - * @param string $file Skin File - * @return \FML\ManiaCode\GetSkin + * @param string $file Skin file + * @return \FML\ManiaCode\GetSkin|static */ public function setFile($file) { - $this->file = (string) $file; + $this->file = (string)$file; return $this; } /** - * Set the Url of the Skin + * Set the url of the skin * - * @param string $url Skin Url - * @return \FML\ManiaCode\GetSkin + * @param string $url Skin url + * @return \FML\ManiaCode\GetSkin|static */ public function setUrl($url) { - $this->url = (string) $url; + $this->url = (string)$url; return $this; } /** - * * @see \FML\ManiaCode\Element::render() */ public function render(\DOMDocument $domDocument) { - $xmlElement = $domDocument->createElement($this->tagName); + $xmlElement = $domDocument->createElement($this->tagName); $nameElement = $domDocument->createElement('name', $this->name); $xmlElement->appendChild($nameElement); $fileElement = $domDocument->createElement('file', $this->file); diff --git a/application/core/Libs/FML/ManiaCode/Go_To.php b/application/core/Libs/FML/ManiaCode/Go_To.php index 8a75266c..58d4b424 100644 --- a/application/core/Libs/FML/ManiaCode/Go_To.php +++ b/application/core/Libs/FML/ManiaCode/Go_To.php @@ -3,58 +3,56 @@ namespace FML\ManiaCode; /** - * ManiaCode Element going to a Link + * ManiaCode Element for going to a link * - * @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 Go_To implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'goto'; - protected $link = ''; + protected $link = null; /** - * Create a new Go_To Element + * Create a new Go_To object * - * @param string $link (optional) Goto Link - * @return \FML\ManiaCode\Go_To + * @param string $link (optional) Goto link + * @return \FML\ManiaCode\Go_To|static */ public static function create($link = null) { - $goTo = new Go_To($link); - return $goTo; + return new static($link); } /** - * Construct a new Go_To Element + * Construct a new Go_To object * - * @param string $link (optional) Goto Link + * @param string $link (optional) Goto link */ public function __construct($link = null) { - if ($link !== null) { + if (!is_null($link)) { $this->setLink($link); } } /** - * Set the Goto Link + * Set link * - * @param string $link Goto Link - * @return \FML\ManiaCode\Go_To + * @param string $link Goto link + * @return \FML\ManiaCode\Go_To|static */ public function setLink($link) { - $this->link = (string) $link; + $this->link = (string)$link; return $this; } /** - * * @see \FML\ManiaCode\Element::render() */ public function render(\DOMDocument $domDocument) { - $xmlElement = $domDocument->createElement($this->tagName); + $xmlElement = $domDocument->createElement($this->tagName); $linkElement = $domDocument->createElement('link', $this->link); $xmlElement->appendChild($linkElement); return $xmlElement; diff --git a/application/core/Libs/FML/ManiaCode/InstallMacroblock.php b/application/core/Libs/FML/ManiaCode/InstallMacroblock.php index 5153c71b..8c5c1136 100644 --- a/application/core/Libs/FML/ManiaCode/InstallMacroblock.php +++ b/application/core/Libs/FML/ManiaCode/InstallMacroblock.php @@ -3,91 +3,89 @@ namespace FML\ManiaCode; /** - * ManiaCode Element installing a Macroblock + * ManiaCode Element installing a macroblock * - * @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 InstallMacroblock implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'install_macroblock'; - protected $name = ''; - protected $file = ''; - protected $url = ''; + protected $name = null; + protected $file = null; + protected $url = null; /** - * Create a new InstallMacroblock Element + * Create a new InstallMacroblock object * - * @param string $name (optional) Macroblock Name - * @param string $url (optional) Macroblock Url - * @return \FML\ManiaCode\InstallMacroblock + * @param string $name (optional) Macroblock name + * @param string $url (optional) Macroblock url + * @return \FML\ManiaCode\InstallMacroblock|static */ public static function create($name = null, $url = null) { - $installMacroblock = new InstallMacroblock($name, $url); - return $installMacroblock; + return new static($name, $url); } /** - * Construct a new InstallMacroblock Element + * Construct a new InstallMacroblock object * - * @param string $name (optional) Macroblock Name - * @param string $file (optional) Macroblock File - * @param string $url (optional) Macroblock Url + * @param string $name (optional) Macroblock name + * @param string $file (optional) Macroblock file + * @param string $url (optional) Macroblock url */ public function __construct($name = null, $file = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($file !== null) { + if (!is_null($file)) { $this->setFile($file); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Macroblock + * Set the name of the macroblock * - * @param string $name Macroblock Name - * @return \FML\ManiaCode\InstallMacroblock + * @param string $name Macroblock name + * @return \FML\ManiaCode\InstallMacroblock|static */ public function setName($name) { - $this->name = (string) $name; + $this->name = (string)$name; return $this; } /** - * Set the File of the Macroblock + * Set the file of the macroblock * - * @param string $file Macroblock File - * @return \FML\ManiaCode\InstallMacroblock + * @param string $file Macroblock file + * @return \FML\ManiaCode\InstallMacroblock|static */ public function setFile($file) { - $this->file = (string) $file; + $this->file = (string)$file; return $this; } /** - * Set the Url of the Macroblock + * Set the url of the macroblock * - * @param string $url Macroblock Url - * @return \FML\ManiaCode\InstallMacroblock + * @param string $url Macroblock url + * @return \FML\ManiaCode\InstallMacroblock|static */ public function setUrl($url) { - $this->url = (string) $url; + $this->url = (string)$url; return $this; } /** - * * @see \FML\ManiaCode\Element::render() */ public function render(\DOMDocument $domDocument) { - $xmlElement = $domDocument->createElement($this->tagName); + $xmlElement = $domDocument->createElement($this->tagName); $nameElement = $domDocument->createElement('name', $this->name); $xmlElement->appendChild($nameElement); $fileElement = $domDocument->createElement('file', $this->file); diff --git a/application/core/Libs/FML/ManiaCode/InstallMap.php b/application/core/Libs/FML/ManiaCode/InstallMap.php index 4be8b026..a023776a 100644 --- a/application/core/Libs/FML/ManiaCode/InstallMap.php +++ b/application/core/Libs/FML/ManiaCode/InstallMap.php @@ -3,7 +3,7 @@ namespace FML\ManiaCode; /** - * ManiaCode Element installing a Map + * ManiaCode Element installing a map * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,44 +11,43 @@ namespace FML\ManiaCode; */ class InstallMap implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'install_map'; - protected $name = ''; - protected $url = ''; + protected $name = null; + protected $url = null; /** - * Create a new InstallMap Element + * Create a new InstallMap object * - * @param string $name (optional) Map Name - * @param string $url (optional) Map Url - * @return \FML\ManiaCode\InstallMap + * @param string $name (optional) Map name + * @param string $url (optional) Map url + * @return \FML\ManiaCode\InstallMap|static */ public static function create($name = null, $url = null) { - $installMap = new InstallMap($name, $url); - return $installMap; + return new static($name, $url); } /** - * Construct a new InstallMap Element + * Construct a new InstallMap object * - * @param string $name (optional) Map Name - * @param string $url (optional) Map Url + * @param string $name (optional) Map name + * @param string $url (optional) Map url */ public function __construct($name = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Map + * Set the name of the map * - * @param string $name Map Name - * @return \FML\ManiaCode\InstallMap + * @param string $name Map name + * @return \FML\ManiaCode\InstallMap|static */ public function setName($name) { $this->name = (string)$name; @@ -56,10 +55,10 @@ class InstallMap implements Element { } /** - * Set the Url of the Map + * Set the url of the map * - * @param string $url Map Url - * @return \FML\ManiaCode\InstallMap + * @param string $url Map url + * @return \FML\ManiaCode\InstallMap|static */ public function setUrl($url) { $this->url = (string)$url; diff --git a/application/core/Libs/FML/ManiaCode/InstallPack.php b/application/core/Libs/FML/ManiaCode/InstallPack.php index 3b6b0511..825a8969 100644 --- a/application/core/Libs/FML/ManiaCode/InstallPack.php +++ b/application/core/Libs/FML/ManiaCode/InstallPack.php @@ -3,7 +3,7 @@ namespace FML\ManiaCode; /** - * ManiaCode Element installing a Title Pack + * ManiaCode Element installing a title pack * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,50 +11,49 @@ namespace FML\ManiaCode; */ class InstallPack implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'install_pack'; - protected $name = ''; - protected $file = ''; - protected $url = ''; + protected $name = null; + protected $file = null; + protected $url = null; /** - * Create a new InstallPack Element + * Create a new InstallPack object * - * @param string $name (optional) Pack Name - * @param string $file (optional) Pack File - * @param string $url (optional) Pack Url - * @return \FML\ManiaCode\InstallPack + * @param string $name (optional) Pack name + * @param string $file (optional) Pack file + * @param string $url (optional) Pack url + * @return \FML\ManiaCode\InstallPack|static */ public static function create($name = null, $file = null, $url = null) { - $installPack = new InstallPack($name, $file, $url); - return $installPack; + return new static($name, $file, $url); } /** - * Construct a new InstallPack Element + * Construct a new InstallPack object * - * @param string $name (optional) Pack Name - * @param string $file (optional) Pack File - * @param string $url (optional) Pack Url + * @param string $name (optional) Pack name + * @param string $file (optional) Pack file + * @param string $url (optional) Pack url */ public function __construct($name = null, $file = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($file !== null) { + if (!is_null($file)) { $this->setFile($file); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Pack + * Set the name of the pack * - * @param string $name Pack Name - * @return \FML\ManiaCode\InstallPack + * @param string $name Pack name + * @return \FML\ManiaCode\InstallPack|static */ public function setName($name) { $this->name = (string)$name; @@ -62,10 +61,10 @@ class InstallPack implements Element { } /** - * Set the File of the Pack + * Set the file of the pack * - * @param string $file Pack File - * @return \FML\ManiaCode\InstallPack + * @param string $file Pack file + * @return \FML\ManiaCode\InstallPack|static */ public function setFile($file) { $this->file = (string)$file; @@ -73,10 +72,10 @@ class InstallPack implements Element { } /** - * Set the Url of the Pack + * Set the url of the pack * - * @param string $url Pack Url - * @return \FML\ManiaCode\InstallPack + * @param string $url Pack url + * @return \FML\ManiaCode\InstallPack|static */ public function setUrl($url) { $this->url = (string)$url; diff --git a/application/core/Libs/FML/ManiaCode/InstallReplay.php b/application/core/Libs/FML/ManiaCode/InstallReplay.php index 5b15ec86..51c2e8cd 100644 --- a/application/core/Libs/FML/ManiaCode/InstallReplay.php +++ b/application/core/Libs/FML/ManiaCode/InstallReplay.php @@ -3,7 +3,7 @@ namespace FML\ManiaCode; /** - * ManiaCode Element installing a Replay + * ManiaCode Element installing a replay * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,44 +11,43 @@ namespace FML\ManiaCode; */ class InstallReplay implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'install_replay'; - protected $name = ''; - protected $url = ''; + protected $name = null; + protected $url = null; /** - * Create a new InstallReplay Element + * Create a new InstallReplay object * - * @param string $name (optional) Replay Name - * @param string $url (optional) Replay Url - * @return \FML\ManiaCode\InstallReplay + * @param string $name (optional) Replay name + * @param string $url (optional) Replay url + * @return \FML\ManiaCode\InstallReplay|static */ public static function create($name = null, $url = null) { - $installReplay = new InstallReplay($name, $url); - return $installReplay; + return new static($name, $url); } /** - * Construct a new InstallReplay Element + * Construct a new InstallReplay object * - * @param string $name (optional) Replay Name - * @param string $url (optional) Replay Url + * @param string $name (optional) Replay name + * @param string $url (optional) Replay url */ public function __construct($name = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Replay + * Set the name of the replay * - * @param string $name Replay Name - * @return \FML\ManiaCode\InstallReplay + * @param string $name Replay name + * @return \FML\ManiaCode\InstallReplay|static */ public function setName($name) { $this->name = (string)$name; @@ -56,10 +55,10 @@ class InstallReplay implements Element { } /** - * Set the Url of the Replay + * Set the url of the replay * - * @param string $url Replay Url - * @return \FML\ManiaCode\InstallReplay + * @param string $url Replay url + * @return \FML\ManiaCode\InstallReplay|static */ public function setUrl($url) { $this->url = (string)$url; diff --git a/application/core/Libs/FML/ManiaCode/InstallScript.php b/application/core/Libs/FML/ManiaCode/InstallScript.php index ac752cf1..74528ff7 100644 --- a/application/core/Libs/FML/ManiaCode/InstallScript.php +++ b/application/core/Libs/FML/ManiaCode/InstallScript.php @@ -3,7 +3,7 @@ namespace FML\ManiaCode; /** - * ManiaCode Element installing a Script + * ManiaCode Element installing a script * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,50 +11,49 @@ namespace FML\ManiaCode; */ class InstallScript implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'install_script'; - protected $name = ''; - protected $file = ''; - protected $url = ''; + protected $name = null; + protected $file = null; + protected $url = null; /** - * Create a new InstallScript Element + * Create a new InstallScript object * - * @param string $name (optional) Script Name - * @param string $file (optional) Script File - * @param string $url (optional) Script Url - * @return \FML\ManiaCode\InstallScript + * @param string $name (optional) Script name + * @param string $file (optional) Script file + * @param string $url (optional) Script url + * @return \FML\ManiaCode\InstallScript|static */ public static function create($name = null, $file = null, $url = null) { - $installScript = new InstallScript($name, $file, $url); - return $installScript; + return new static($name, $file, $url); } /** - * Construct a new InstallScript Element + * Construct a new InstallScript object * - * @param string $name (optional) Script Name - * @param string $file (optional) Script File - * @param string $url (optional) Script Url + * @param string $name (optional) Script name + * @param string $file (optional) Script file + * @param string $url (optional) Script url */ public function __construct($name = null, $file = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($file !== null) { + if (!is_null($file)) { $this->setFile($file); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Script + * Set the name of the script * - * @param string $name Script Name - * @return \FML\ManiaCode\InstallScript + * @param string $name Script name + * @return \FML\ManiaCode\InstallScript|static */ public function setName($name) { $this->name = (string)$name; @@ -62,10 +61,10 @@ class InstallScript implements Element { } /** - * Set the File of the Script + * Set the file of the script * - * @param string $file Script File - * @return \FML\ManiaCode\InstallScript + * @param string $file Script file + * @return \FML\ManiaCode\InstallScript|static */ public function setFile($file) { $this->file = (string)$file; @@ -73,10 +72,10 @@ class InstallScript implements Element { } /** - * Set the Url of the Script + * Set the url of the script * - * @param string $url Script Url - * @return \FML\ManiaCode\InstallScript + * @param string $url Script url + * @return \FML\ManiaCode\InstallScript|static */ public function setUrl($url) { $this->url = (string)$url; diff --git a/application/core/Libs/FML/ManiaCode/InstallSkin.php b/application/core/Libs/FML/ManiaCode/InstallSkin.php index e0046138..eafcfcfd 100644 --- a/application/core/Libs/FML/ManiaCode/InstallSkin.php +++ b/application/core/Libs/FML/ManiaCode/InstallSkin.php @@ -3,7 +3,7 @@ namespace FML\ManiaCode; /** - * ManiaCode Element installing a Skin + * ManiaCode Element installing a skin * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,50 +11,49 @@ namespace FML\ManiaCode; */ class InstallSkin implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'install_skin'; - protected $name = ''; - protected $file = ''; - protected $url = ''; + protected $name = null; + protected $file = null; + protected $url = null; /** - * Create a new InstallSkin Element + * Create a new InstallSkin object * - * @param string $name (optional) Skin Name - * @param string $file (optional) Skin File - * @param string $url (optional) Skin Url - * @return \FML\ManiaCode\InstallSkin + * @param string $name (optional) Skin name + * @param string $file (optional) Skin file + * @param string $url (optional) Skin url + * @return \FML\ManiaCode\InstallSkin|static */ public static function create($name = null, $file = null, $url = null) { - $installSkin = new InstallSkin($name, $file, $url); - return $installSkin; + return new static($name, $file, $url); } /** - * Construct a new InstallSkin Element + * Construct a new InstallSkin object * - * @param string $name (optional) Skin Name - * @param string $file (optional) Skin File - * @param string $url (optional) Skin Url + * @param string $name (optional) Skin name + * @param string $file (optional) Skin file + * @param string $url (optional) Skin url */ public function __construct($name = null, $file = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($file !== null) { + if (!is_null($file)) { $this->setFile($file); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Skin + * Set the name of the skin * - * @param string $name Skin Name - * @return \FML\ManiaCode\InstallSkin + * @param string $name Skin name + * @return \FML\ManiaCode\InstallSkin|static */ public function setName($name) { $this->name = (string)$name; @@ -62,10 +61,10 @@ class InstallSkin implements Element { } /** - * Set the File of the Skin + * Set the file of the skin * - * @param string $file Skin File - * @return \FML\ManiaCode\InstallSkin + * @param string $file Skin file + * @return \FML\ManiaCode\InstallSkin|static */ public function setFile($file) { $this->file = (string)$file; @@ -73,10 +72,10 @@ class InstallSkin implements Element { } /** - * Set the Url of the Skin + * Set the url of the skin * - * @param string $url Skin Url - * @return \FML\ManiaCode\InstallSkin + * @param string $url Skin url + * @return \FML\ManiaCode\InstallSkin|static */ public function setUrl($url) { $this->url = (string)$url; diff --git a/application/core/Libs/FML/ManiaCode/JoinServer.php b/application/core/Libs/FML/ManiaCode/JoinServer.php index 96b79ae4..ec351d9c 100644 --- a/application/core/Libs/FML/ManiaCode/JoinServer.php +++ b/application/core/Libs/FML/ManiaCode/JoinServer.php @@ -3,7 +3,7 @@ namespace FML\ManiaCode; /** - * ManiaCode Element joining a Server + * ManiaCode Element for joining a server * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,59 +11,58 @@ namespace FML\ManiaCode; */ class JoinServer implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'join_server'; - protected $login = ''; - protected $ip = null; - protected $port = null; + protected $login = null; + protected $serverIp = null; + protected $serverPort = null; /** - * Create a new JoinServer Element + * Create a new JoinServer object * - * @param string $login (optional) Server Login - * @return \FML\ManiaCode\JoinServer + * @param string $login (optional) Server login + * @return \FML\ManiaCode\JoinServer|static */ public static function create($login = null) { - $joinServer = new JoinServer($login); - return $joinServer; + return new static($login); } /** - * Construct a new JoinServer Element + * Construct a new JoinServer object * - * @param string $login (optional) Server Login + * @param string $login (optional) Server login */ public function __construct($login = null) { - if ($login !== null) { + if (!is_null($login)) { $this->setLogin($login); } } /** - * Set the Server Login + * Set the server login * - * @param string $login Server Login - * @return \FML\ManiaCode\JoinServer + * @param string $login Server login + * @return \FML\ManiaCode\JoinServer|static */ public function setLogin($login) { - $this->login = (string)$login; - $this->ip = null; - $this->port = null; + $this->login = (string)$login; + $this->serverIp = null; + $this->serverPort = null; return $this; } /** - * Set the Server Ip and Port + * Set the server ip and port * - * @param string $ip Server Ip - * @param int $port Server Port - * @return \FML\ManiaCode\JoinServer + * @param string $serverIp Server ip + * @param int $serverPort Server port + * @return \FML\ManiaCode\JoinServer|static */ - public function setIp($ip, $port) { - $this->ip = (string)$ip; - $this->port = (int)$port; - $this->login = null; + public function setIp($serverIp, $serverPort) { + $this->serverIp = (string)$serverIp; + $this->serverPort = (int)$serverPort; + $this->login = null; return $this; } @@ -72,11 +71,11 @@ class JoinServer implements Element { */ public function render(\DOMDocument $domDocument) { $xmlElement = $domDocument->createElement($this->tagName); - if ($this->ip === null) { + if (is_null($this->serverIp)) { $loginElement = $domDocument->createElement('login', $this->login); $xmlElement->appendChild($loginElement); } else { - $ipElement = $domDocument->createElement('ip', $this->ip . ':' . $this->port); + $ipElement = $domDocument->createElement('ip', $this->serverIp . ':' . $this->serverPort); $xmlElement->appendChild($ipElement); } return $xmlElement; diff --git a/application/core/Libs/FML/ManiaCode/PlayMap.php b/application/core/Libs/FML/ManiaCode/PlayMap.php index 4022cade..1b3ee233 100644 --- a/application/core/Libs/FML/ManiaCode/PlayMap.php +++ b/application/core/Libs/FML/ManiaCode/PlayMap.php @@ -3,7 +3,7 @@ namespace FML\ManiaCode; /** - * ManiaCode Element playing a Map + * ManiaCode Element for playing a map * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,44 +11,43 @@ namespace FML\ManiaCode; */ class PlayMap implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'play_map'; - protected $name = ''; - protected $url = ''; + protected $name = null; + protected $url = null; /** - * Create a new PlayMap Element + * Create a new PlayMap object * - * @param string $name (optional) Map Name - * @param string $url (optional) Map Url - * @return \FML\ManiaCode\PlayMap + * @param string $name (optional) Map name + * @param string $url (optional) Map url + * @return \FML\ManiaCode\PlayMap|static */ public static function create($name = null, $url = null) { - $playMap = new PlayMap($name, $url); - return $playMap; + return new static($name, $url); } /** - * Construct a new PlayMap Element + * Construct a new PlayMap object * - * @param string $name (optional) Map Name - * @param string $url (optional) Map Url + * @param string $name (optional) Map name + * @param string $url (optional) Map url */ public function __construct($name = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Map + * Set the name of the map * - * @param string $name Map Name - * @return \FML\ManiaCode\PlayMap + * @param string $name Map name + * @return \FML\ManiaCode\PlayMap|static */ public function setName($name) { $this->name = (string)$name; @@ -56,10 +55,10 @@ class PlayMap implements Element { } /** - * Set the Url of the Map + * Set the url of the map * - * @param string $url Map Url - * @return \FML\ManiaCode\PlayMap + * @param string $url Map url + * @return \FML\ManiaCode\PlayMap|static */ public function setUrl($url) { $this->url = (string)$url; diff --git a/application/core/Libs/FML/ManiaCode/PlayReplay.php b/application/core/Libs/FML/ManiaCode/PlayReplay.php index 87a90051..a9d9723e 100644 --- a/application/core/Libs/FML/ManiaCode/PlayReplay.php +++ b/application/core/Libs/FML/ManiaCode/PlayReplay.php @@ -3,7 +3,7 @@ namespace FML\ManiaCode; /** - * ManiaCode Element playing a Replay + * ManiaCode Element playing a replay * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,44 +11,43 @@ namespace FML\ManiaCode; */ class PlayReplay implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'play_replay'; - protected $name = ''; - protected $url = ''; + protected $name = null; + protected $url = null; /** - * Create a new PlayReplay Element + * Create a new PlayReplay object * - * @param string $name (optional) Replay Name - * @param string $url (optional) Replay Url - * @return \FML\ManiaCode\PlayReplay + * @param string $name (optional) Replay name + * @param string $url (optional) Replay url + * @return \FML\ManiaCode\PlayReplay|static */ public static function create($name = null, $url = null) { - $playReplay = new PlayReplay($name, $url); - return $playReplay; + return new static($name, $url); } /** - * Construct a new PlayReplay Element + * Construct a new PlayReplay object * - * @param string $name (optional) Replay Name - * @param string $url (optional) Replay Url + * @param string $name (optional) Replay name + * @param string $url (optional) Replay url */ public function __construct($name = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Replay + * Set the name of the replay * - * @param string $name Replay Name - * @return \FML\ManiaCode\PlayReplay + * @param string $name Replay name + * @return \FML\ManiaCode\PlayReplay|static */ public function setName($name) { $this->name = (string)$name; @@ -56,10 +55,10 @@ class PlayReplay implements Element { } /** - * Set the Url of the Replay + * Set the url of the replay * - * @param string $url Replay Url - * @return \FML\ManiaCode\PlayReplay + * @param string $url Replay url + * @return \FML\ManiaCode\PlayReplay|static */ public function setUrl($url) { $this->url = (string)$url; diff --git a/application/core/Libs/FML/ManiaCode/ShowMessage.php b/application/core/Libs/FML/ManiaCode/ShowMessage.php index 67ee20ec..d3c5455b 100644 --- a/application/core/Libs/FML/ManiaCode/ShowMessage.php +++ b/application/core/Libs/FML/ManiaCode/ShowMessage.php @@ -11,38 +11,37 @@ namespace FML\ManiaCode; */ class ShowMessage implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'show_message'; - protected $message = ''; + protected $message = null; /** - * Create a new ShowMessage Element + * Create a new ShowMessage object * - * @param string $message (optional) Message Text - * @return \FML\ManiaCode\ShowMessage + * @param string $message (optional) Message text + * @return \FML\ManiaCode\ShowMessage|static */ public static function create($message = null) { - $showMessage = new ShowMessage($message); - return $showMessage; + return new static($message); } /** - * Construct a new ShowMessage Element + * Construct a new ShowMessage object * - * @param string $message (optional) Message Text + * @param string $message (optional) Message text */ public function __construct($message = null) { - if ($message !== null) { + if (!is_null($message)) { $this->setMessage($message); } } /** - * Set the displayed Message Text + * Set the message text * - * @param string $message Message Text - * @return \FML\ManiaCode\ShowMessage + * @param string $message Message text + * @return \FML\ManiaCode\ShowMessage|static */ public function setMessage($message) { $this->message = (string)$message; diff --git a/application/core/Libs/FML/ManiaCode/ViewReplay.php b/application/core/Libs/FML/ManiaCode/ViewReplay.php index a9f6b965..74ca642b 100644 --- a/application/core/Libs/FML/ManiaCode/ViewReplay.php +++ b/application/core/Libs/FML/ManiaCode/ViewReplay.php @@ -3,7 +3,7 @@ namespace FML\ManiaCode; /** - * ManiaCode Element viewing a Replay + * ManiaCode Element for viewing a replay * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,44 +11,43 @@ namespace FML\ManiaCode; */ class ViewReplay implements Element { /* - * Protected Properties + * Protected properties */ protected $tagName = 'view_replay'; - protected $name = ''; - protected $url = ''; + protected $name = null; + protected $url = null; /** - * Create a new ViewReplay Element + * Create a new ViewReplay object * - * @param string $name (optional) Replay Name - * @param string $url (optional) Replay Url - * @return \FML\ManiaCode\ViewReplay + * @param string $name (optional) Replay name + * @param string $url (optional) Replay url + * @return \FML\ManiaCode\ViewReplay|static */ public static function create($name = null, $url = null) { - $viewReplay = new ViewReplay($name, $url); - return $viewReplay; + return new static($name, $url); } /** - * Construct a new ViewReplay Element + * Construct a new ViewReplay object * - * @param string $name (optional) Replay Name - * @param string $url (optional) Replay Url + * @param string $name (optional) Replay name + * @param string $url (optional) Replay url */ public function __construct($name = null, $url = null) { - if ($name !== null) { + if (!is_null($name)) { $this->setName($name); } - if ($url !== null) { + if (!is_null($url)) { $this->setUrl($url); } } /** - * Set the Name of the Replay + * Set the name of the replay * - * @param string $name Replay Name - * @return \FML\ManiaCode\ViewReplay + * @param string $name Replay name + * @return \FML\ManiaCode\ViewReplay|static */ public function setName($name) { $this->name = (string)$name; @@ -56,10 +55,10 @@ class ViewReplay implements Element { } /** - * Set the Url of the Replay + * Set the url of the replay * - * @param string $url Replay Url - * @return \FML\ManiaCode\ViewReplay + * @param string $url Replay url + * @return \FML\ManiaCode\ViewReplay|static */ public function setUrl($url) { $this->url = (string)$url; diff --git a/application/core/Libs/FML/ManiaLink.php b/application/core/Libs/FML/ManiaLink.php index 4106e64c..a65c40cf 100644 --- a/application/core/Libs/FML/ManiaLink.php +++ b/application/core/Libs/FML/ManiaLink.php @@ -26,15 +26,16 @@ class ManiaLink { const BACKGROUND_TITLE = 'title'; /* - * Protected Properties + * Protected properties */ protected $encoding = 'utf-8'; protected $tagName = 'manialink'; - protected $id = ''; + protected $maniaLinkId = null; protected $version = 1; - protected $background = ''; + protected $background = null; protected $navigable3d = 1; protected $timeout = 0; + /** @var Renderable[] $children */ protected $children = array(); /** @var Dico $dico */ protected $dico = null; @@ -44,32 +45,31 @@ class ManiaLink { protected $script = null; /** - * Create a new ManiaLink Object + * Create a new ManiaLink object * - * @param string $id (optional) ManiaLink Id - * @return \FML\ManiaLink + * @param string $maniaLinkId (optional) ManiaLink id + * @return \FML\ManiaLink|static */ - public static function create($id = null) { - $maniaLink = new ManiaLink($id); - return $maniaLink; + public static function create($maniaLinkId = null) { + return new static($maniaLinkId); } /** - * Construct a new ManiaLink Object + * Construct a new ManiaLink object * - * @param string $id (optional) ManiaLink Id + * @param string $maniaLinkId (optional) ManiaLink id */ - public function __construct($id = null) { - if ($id !== null) { - $this->setId($id); + public function __construct($maniaLinkId = null) { + if (!is_null($maniaLinkId)) { + $this->setId($maniaLinkId); } } /** - * Set XML Encoding + * Set XML encoding * - * @param string $encoding XML Encoding - * @return \FML\ManiaLink + * @param string $encoding XML encoding + * @return \FML\ManiaLink|static */ public function setXmlEncoding($encoding) { $this->encoding = (string)$encoding; @@ -77,30 +77,30 @@ class ManiaLink { } /** - * Set ManiaLink Id + * Set ManiaLink id * - * @param string $id ManiaLink Id - * @return \FML\ManiaLink + * @param string $maniaLinkId ManiaLink id + * @return \FML\ManiaLink|static */ - public function setId($id) { - $this->id = (string)$id; + public function setId($maniaLinkId) { + $this->maniaLinkId = (string)$maniaLinkId; return $this; } /** - * Get ManiaLink Id + * Get ManiaLink id * * @return string */ public function getId() { - return $this->id; + return $this->maniaLinkId; } /** - * Set Background + * Set background * - * @param string $background Background Value - * @return \FML\ManiaLink + * @param string $background Background value + * @return \FML\ManiaLink|static */ public function setBackground($background) { $this->background = (string)$background; @@ -108,10 +108,10 @@ class ManiaLink { } /** - * Set Navigable3d + * Set navigable3d * * @param bool $navigable3d Whether the manialink should be 3d navigable - * @return \FML\ManiaLink + * @return \FML\ManiaLink|static */ public function setNavigable3d($navigable3d) { $this->navigable3d = ($navigable3d ? 1 : 0); @@ -119,10 +119,10 @@ class ManiaLink { } /** - * Set Timeout + * Set timeout * - * @param int $timeout Timeout Duration - * @return \FML\ManiaLink + * @param int $timeout Timeout duration + * @return \FML\ManiaLink|static */ public function setTimeout($timeout) { $this->timeout = (int)$timeout; @@ -130,10 +130,10 @@ class ManiaLink { } /** - * Add an Element to the ManiaLink + * Add an element to the ManiaLink * - * @param Renderable $child Child Element to add - * @return \FML\ManiaLink + * @param Renderable $child Child element to add + * @return \FML\ManiaLink|static */ public function add(Renderable $child) { if (!in_array($child, $this->children, true)) { @@ -143,9 +143,9 @@ class ManiaLink { } /** - * Remove all Elements from the ManiaLinks + * Remove all elements from the ManiaLink * - * @return \FML\ManiaLink + * @return \FML\ManiaLink|static */ public function removeChildren() { $this->children = array(); @@ -155,7 +155,7 @@ class ManiaLink { /** * Set the Dictionary of the ManiaLink * - * @param Dico $dico The Dictionary to use + * @param Dico $dico Dictionary for the ManiaLink * @return \FML\ManiaLink */ public function setDico(Dico $dico) { @@ -164,9 +164,9 @@ class ManiaLink { } /** - * Get the current Dictionary of the ManiaLink + * Get the Dictionary of the ManiaLink * - * @param bool $createIfEmpty (optional) Whether the Dico Object should be created if it's not set yet + * @param bool $createIfEmpty (optional) Whether the Dico object should be created if it's not set * @return \FML\Elements\Dico */ public function getDico($createIfEmpty = true) { @@ -179,8 +179,8 @@ class ManiaLink { /** * Set the Stylesheet of the ManiaLink * - * @param Stylesheet $stylesheet Stylesheet Object - * @return \FML\ManiaLink + * @param Stylesheet $stylesheet Stylesheet for the ManiaLink + * @return \FML\ManiaLink|static */ public function setStylesheet(Stylesheet $stylesheet) { $this->stylesheet = $stylesheet; @@ -190,7 +190,7 @@ class ManiaLink { /** * Get the Stylesheet of the ManiaLink * - * @param bool $createIfEmpty (optional) Whether the Script Object should be created if it's not set yet + * @param bool $createIfEmpty (optional) Whether the Stylesheet object should be created if it's not set * @return \FML\Stylesheet\Stylesheet */ public function getStylesheet($createIfEmpty = true) { @@ -203,8 +203,8 @@ class ManiaLink { /** * Set the Script of the ManiaLink * - * @param Script $script The Script for the ManiaLink - * @return \FML\ManiaLink + * @param Script $script Script for the ManiaLink + * @return \FML\ManiaLink|static */ public function setScript(Script $script) { $this->script = $script; @@ -214,7 +214,7 @@ class ManiaLink { /** * Get the current Script of the ManiaLink * - * @param bool $createIfEmpty (optional) Whether the Script Object should be created if it's not set yet + * @param bool $createIfEmpty (optional) Whether the Script object should be created if it's not set * @return \FML\Script\Script */ public function getScript($createIfEmpty = true) { @@ -225,10 +225,10 @@ class ManiaLink { } /** - * Render the XML Document + * Render the XML document * - * @param bool (optional) $echo If the XML Text should be echoed and the Content-Type Header should be set - * @param \DOMDocument $domDocument (optional) DOMDocument for which the XML Element should be created + * @param bool $echo (optional) If the XML text should be echoed and the Content-Type header should be set + * @param \DOMDocument $domDocument (optional) DOMDocument for which the XML element should be created * @return \DOMDocument */ public function render($echo = false, $domDocument = null) { @@ -241,8 +241,8 @@ class ManiaLink { if (!$isChild) { $domDocument->appendChild($maniaLink); } - if (strlen($this->id) > 0) { - $maniaLink->setAttribute('id', $this->id); + if (strlen($this->maniaLinkId) > 0) { + $maniaLink->setAttribute('id', $this->maniaLinkId); } if ($this->version) { $maniaLink->setAttribute('version', $this->version); @@ -263,7 +263,6 @@ class ManiaLink { } $scriptFeatures = array(); foreach ($this->children as $child) { - /** @var Renderable $child */ $childXml = $child->render($domDocument, $this->getScript()); $maniaLink->appendChild($childXml); if ($child instanceof ScriptFeatureable) { @@ -295,13 +294,11 @@ class ManiaLink { } /** - * Get String Representation + * Get string representation * * @return string */ public function __toString() { - $domDocument = $this->render(); - $xmlText = $domDocument->saveXML(); - return $xmlText; + return $this->render()->saveXML(); } } diff --git a/application/core/Libs/FML/ManiaLinks.php b/application/core/Libs/FML/ManiaLinks.php index f5a8b22f..ca976bfa 100644 --- a/application/core/Libs/FML/ManiaLinks.php +++ b/application/core/Libs/FML/ManiaLinks.php @@ -15,31 +15,25 @@ class ManiaLinks { */ protected $encoding = 'utf-8'; protected $tagName = 'manialinks'; + /** @var ManiaLink[] $children */ protected $children = array(); /** @var CustomUI $customUI */ protected $customUI = null; /** - * Create a new ManiaLinks Object + * Create a new ManiaLinks object * - * @return \FML\ManiaLinks + * @return \FML\ManiaLinks|static */ public static function create() { - $maniaLinks = new ManiaLinks(); - return $maniaLinks; + return new static(); } /** - * Construct a new ManiaLinks Object - */ - public function __construct() { - } - - /** - * Set XML Encoding + * Set XML encoding * - * @param string $encoding XML Encoding - * @return \FML\ManiaLinks + * @param string $encoding XML encoding + * @return \FML\ManiaLinks|static */ public function setXmlEncoding($encoding) { $this->encoding = (string)$encoding; @@ -47,7 +41,7 @@ class ManiaLinks { } /** - * Add a Child ManiaLink + * Add a child ManiaLink * * @param ManiaLink $child Child ManiaLink * @return \FML\ManiaLinks @@ -60,9 +54,9 @@ class ManiaLinks { } /** - * Remove all Child ManiaLinks + * Remove all child ManiaLinks * - * @return \FML\ManiaLinks + * @return \FML\ManiaLinks|static */ public function removeChildren() { $this->children = array(); @@ -72,8 +66,8 @@ class ManiaLinks { /** * Set the CustomUI * - * @param CustomUI $customUI The CustomUI Object - * @return \FML\ManiaLinks + * @param CustomUI $customUI CustomUI object + * @return \FML\ManiaLinks|static */ public function setCustomUI(CustomUI $customUI) { $this->customUI = $customUI; @@ -81,9 +75,9 @@ class ManiaLinks { } /** - * Get the current CustomUI + * Get the CustomUI * - * @param bool $createIfEmpty (optional) Whether the CustomUI Object should be created if it's not set yet + * @param bool $createIfEmpty (optional) Whether the CustomUI object should be created if it's not set * @return \FML\CustomUI */ public function getCustomUI($createIfEmpty = true) { @@ -94,9 +88,9 @@ class ManiaLinks { } /** - * Render the XML Document + * Render the XML document * - * @param bool (optional) $echo Whether the XML Text should be echoed and the Content-Type Header should be set + * @param bool (optional) $echo Whether the XML text should be echoed and the Content-Type header should be set * @return \DOMDocument */ public function render($echo = false) { @@ -105,7 +99,6 @@ class ManiaLinks { $maniaLinks = $domDocument->createElement($this->tagName); $domDocument->appendChild($maniaLinks); foreach ($this->children as $child) { - /** @var ManiaLink $child */ $childXml = $child->render(false, $domDocument); $maniaLinks->appendChild($childXml); } @@ -121,13 +114,11 @@ class ManiaLinks { } /** - * Get String Representation + * Get string representation * * @return string */ public function __toString() { - $domDocument = $this->render(); - $xmlText = $domDocument->saveXML(); - return $xmlText; + return $this->render()->saveXML(); } } diff --git a/application/core/Libs/FML/Models/CheckBoxDesign.php b/application/core/Libs/FML/Models/CheckBoxDesign.php index 625aa7e4..b63a2f20 100644 --- a/application/core/Libs/FML/Models/CheckBoxDesign.php +++ b/application/core/Libs/FML/Models/CheckBoxDesign.php @@ -17,40 +17,38 @@ use FML\Types\SubStyleable; */ class CheckBoxDesign implements Styleable, SubStyleable { /* - * Protected Properties + * Protected properties */ protected $url = null; protected $style = null; protected $subStyle = null; /** - * Create the Default Enabled Design + * Create the default enabled Design * - * @return \FML\Models\CheckBoxDesign + * @return \FML\Models\CheckBoxDesign|static */ public static function defaultEnabledDesign() { - $checkBoxDesign = new CheckBoxDesign(Quad_Icons64x64_1::STYLE, Quad_Icons64x64_1::SUBSTYLE_LvlGreen); - return $checkBoxDesign; + return new static(Quad_Icons64x64_1::STYLE, Quad_Icons64x64_1::SUBSTYLE_Check); } /** - * Create the Default Disabled Design + * Create the default disabled Design * - * @return \FML\Models\CheckBoxDesign + * @return \FML\Models\CheckBoxDesign|static */ public static function defaultDisabledDesign() { - $checkBoxDesign = new CheckBoxDesign(Quad_Icons64x64_1::STYLE, Quad_Icons64x64_1::SUBSTYLE_LvlRed); - return $checkBoxDesign; + return new static(Quad_Icons64x64_1::STYLE, Quad_Icons64x64_1::SUBSTYLE_Check); } /** - * Create a new CheckBox Design + * Construct a new CheckBox Design object * - * @param string $style Style Name or Image Url - * @param string $subStyle SubStyle Name + * @param string $style Style name or image url + * @param string $subStyle (optional) SubStyle name */ public function __construct($style, $subStyle = null) { - if ($subStyle === null) { + if (is_null($subStyle)) { $this->setImageUrl($style); } else { $this->setStyle($style); @@ -59,10 +57,10 @@ class CheckBoxDesign implements Styleable, SubStyleable { } /** - * Set the Image Url + * Set the image url * - * @param string $url Image Url - * @return \FML\Models\CheckBoxDesign + * @param string $url Image url + * @return \FML\Models\CheckBoxDesign|static */ public function setImageUrl($url) { $this->url = (string)$url; @@ -102,7 +100,7 @@ class CheckBoxDesign implements Styleable, SubStyleable { * Apply the Design to the given Quad * * @param Quad $quad CheckBox Quad - * @return \FML\Models\CheckBoxDesign + * @return \FML\Models\CheckBoxDesign|static */ public function applyToQuad(Quad $quad) { $quad->setImage($this->url); @@ -111,19 +109,20 @@ class CheckBoxDesign implements Styleable, SubStyleable { } /** - * Get the CheckBox Design String + * Get the CheckBox Design string * - * @param bool $escaped (optional) Whether the String should be escaped for the Script + * @param bool $escaped (optional) Whether the string should be escaped for the Script + * @param bool $addApostrophes (optional) Whether to add apostrophes before and after the text * @return string */ - public function getDesignString($escaped = true) { - if ($this->url !== null) { + public function getDesignString($escaped = true, $addApostrophes = true) { + if (!is_null($this->url)) { $string = $this->url; } else { $string = $this->style . '|' . $this->subStyle;; } if ($escaped) { - return Builder::escapeText($string); + return Builder::escapeText($string, $addApostrophes); } return $string; } diff --git a/application/core/Libs/FML/Script/Builder.php b/application/core/Libs/FML/Script/Builder.php index 2f856e8b..a1d97a00 100644 --- a/application/core/Libs/FML/Script/Builder.php +++ b/application/core/Libs/FML/Script/Builder.php @@ -3,20 +3,24 @@ namespace FML\Script; /** - * Builder Class offering Methods to build ManiaScript + * ManiaScript Builder class * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ abstract class Builder { + /* + * Constants + */ + const EMPTY_STRING = '""'; /** - * Build a Label Implementation Block + * Build a label implementation block * - * @param string $labelName Name of the Label - * @param string $implementationCode Label Implementation Coding (without declaration) - * @param bool $isolate Whether the Code should be isolated in an own Block + * @param string $labelName Name of the label + * @param string $implementationCode Label implementation coding (without declaration) + * @param bool $isolate Whether the code should be isolated in an own block * @return string */ public static function getLabelImplementationBlock($labelName, $implementationCode, $isolate = true) { @@ -28,10 +32,10 @@ abstract class Builder { } /** - * Escape dangerous Characters in the given Text + * Escape dangerous characters in the given text * * @param string $text Text to escape - * @param bool $addApostrophes (optional) Whether to add Apostrophes before and after the Text + * @param bool $addApostrophes (optional) Whether to add apostrophes before and after the text * @return string */ public static function escapeText($text, $addApostrophes = false) { @@ -45,9 +49,9 @@ abstract class Builder { } /** - * Get the Real String-Representation of the given Value + * Get the 'Real' string representation of the given value * - * @param float $value The Float Value to convert to a ManiaScript Real + * @param float $value Float value to convert to a ManiaScript 'Real' * @return string */ public static function getReal($value) { @@ -60,24 +64,24 @@ abstract class Builder { } /** - * Get the Boolean String-Representation of the given Value + * Get the 'Boolean' string representation of the given value * - * @param bool $value The Value to convert to a ManiaScript Boolean + * @param bool $value Value to convert to a ManiaScript 'Boolean' * @return string */ public static function getBoolean($value) { $bool = (bool)$value; if ($bool) { - return "True"; + return 'True'; } - return "False"; + return 'False'; } /** - * Get the String-Representation of the given Array + * Get the string representation of the given array * - * @param array $array Array to convert to a ManiaScript Array - * @param bool $associative (optional) Whether the Array should be associative + * @param array $array Array to convert to a ManiaScript array + * @param bool $associative (optional) Whether the array should be associative * @return string */ public static function getArray(array $array, $associative = false) { @@ -87,14 +91,14 @@ abstract class Builder { foreach ($array as $key => $value) { if ($associative) { if (is_string($key)) { - $arrayText .= '"' . self::escapeText($key) . '"'; + $arrayText .= '"' . static::escapeText($key) . '"'; } else { $arrayText .= $key; } $arrayText .= ' => '; } if (is_string($value)) { - $arrayText .= '"' . self::escapeText($value) . '"'; + $arrayText .= '"' . static::escapeText($value) . '"'; } else { $arrayText .= $value; } @@ -108,17 +112,18 @@ abstract class Builder { } /** - * Get the Include Command for the given File and Namespace + * Get the include command for the given file and namespace * - * @param string $file Include File - * @param string $namespace (optional) Include Namespace + * @param string $file Include file + * @param string $namespace (optional) Include namespace * @return string */ public static function getInclude($file, $namespace = null) { if (!$namespace && stripos($file, '.') === false) { $namespace = $file; } - $includeText = "#Include \"{$file}\""; + $file = static::escapeText($file, true); + $includeText = "#Include {$file}"; if ($namespace) { $includeText .= " as {$namespace}"; } @@ -127,15 +132,17 @@ abstract class Builder { } /** - * Get the Constant Command for the given Name and Value + * Get the constant command for the given name and value * - * @param string $name Constant Name - * @param string $value Constant Value + * @param string $name Constant name + * @param string $value Constant value * @return string */ public static function getConstant($name, $value) { if (is_string($value)) { - $value = '"' . $value . '"'; + $value = static::escapeText($value, true); + } else if (is_bool($value)) { + $value = static::getBoolean($value); } $constantText = "#Const {$name} {$value}" . PHP_EOL; return $constantText; diff --git a/application/core/Libs/FML/Script/Features/ActionTrigger.php b/application/core/Libs/FML/Script/Features/ActionTrigger.php index 3356109b..fe2766f6 100644 --- a/application/core/Libs/FML/Script/Features/ActionTrigger.php +++ b/application/core/Libs/FML/Script/Features/ActionTrigger.php @@ -9,7 +9,7 @@ use FML\Script\ScriptLabel; use FML\Types\Scriptable; /** - * Script Feature for triggering a Page Action + * Script Feature for triggering a manialink page action * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -17,7 +17,7 @@ use FML\Types\Scriptable; */ class ActionTrigger extends ScriptFeature { /* - * Protected Properties + * Protected properties */ protected $actionName = null; /** @var Control $control */ @@ -27,24 +27,30 @@ class ActionTrigger extends ScriptFeature { /** * Construct a new Action Trigger Feature * - * @param string $actionName (optional) Triggered Action + * @param string $actionName (optional) Triggered action * @param Control $control (optional) Action Control - * @param string $labelName (optional) Script Label Name + * @param string $labelName (optional) Script Label name */ public function __construct($actionName = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK) { - $this->setActionName($actionName); - $this->setControl($control); - $this->setLabelName($labelName); + if (!is_null($actionName)) { + $this->setActionName($actionName); + } + if (!is_null($control)) { + $this->setControl($control); + } + if (!is_null($labelName)) { + $this->setLabelName($labelName); + } } /** - * Set the Action to trigger + * Set the action to trigger * * @param string $actionName - * @return \FML\Script\Features\ActionTrigger + * @return \FML\Script\Features\ActionTrigger|static */ public function setActionName($actionName) { - $this->actionName = $actionName; + $this->actionName = (string)$actionName; return $this; } @@ -52,7 +58,7 @@ class ActionTrigger extends ScriptFeature { * Set the Control * * @param Control $control Action Control - * @return \FML\Script\Features\ActionTrigger + * @return \FML\Script\Features\ActionTrigger|static */ public function setControl(Control $control) { $control->checkId(); @@ -64,13 +70,13 @@ class ActionTrigger extends ScriptFeature { } /** - * Set the Label Name + * Set the label name * - * @param string $labelName Script Label Name - * @return \FML\Script\Features\ActionTrigger + * @param string $labelName Script Label name + * @return \FML\Script\Features\ActionTrigger|static */ public function setLabelName($labelName) { - $this->labelName = $labelName; + $this->labelName = (string)$labelName; return $this; } @@ -83,23 +89,23 @@ class ActionTrigger extends ScriptFeature { } /** - * Get the Script Text + * Get the script text * * @return string */ protected function getScriptText() { - $actionName = Builder::escapeText($this->actionName); + $actionName = Builder::escapeText($this->actionName, true); if ($this->control) { // Control event - $controlId = Builder::escapeText($this->control->getId()); + $controlId = Builder::escapeText($this->control->getId(), true); $scriptText = " -if (Event.Control.ControlId == \"{$controlId}\") { - TriggerPageAction(\"{$actionName}\"); +if (Event.Control.ControlId == {$controlId}) { + TriggerPageAction({$actionName}); }"; } else { // Other $scriptText = " -TriggerPageAction(\"{$actionName}\");"; +TriggerPageAction({$actionName});"; } return $scriptText; } diff --git a/application/core/Libs/FML/Script/Features/CheckBoxFeature.php b/application/core/Libs/FML/Script/Features/CheckBoxFeature.php index b054da41..7c3d93f1 100644 --- a/application/core/Libs/FML/Script/Features/CheckBoxFeature.php +++ b/application/core/Libs/FML/Script/Features/CheckBoxFeature.php @@ -11,7 +11,7 @@ use FML\Script\ScriptInclude; use FML\Script\ScriptLabel; /** - * Script Feature for creating a CheckBox Behavior + * Script Feature for creating a CheckBox behavior * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -27,7 +27,7 @@ class CheckBoxFeature extends ScriptFeature { const VAR_CHECKBOX_ENTRY_ID = 'FML_CheckBox_EntryId'; /* - * Protected Properties + * Protected properties */ /** @var Quad $quad */ protected $quad = null; @@ -44,12 +44,18 @@ class CheckBoxFeature extends ScriptFeature { * * @param Quad $quad (optional) CheckBox Quad * @param Entry $entry (optional) Hidden Entry - * @param bool $default (optional) Default Value + * @param bool $default (optional) Default value */ public function __construct(Quad $quad = null, Entry $entry = null, $default = null) { - $this->setQuad($quad); - $this->setEntry($entry); - $this->setDefault($default); + if (!is_null($quad)) { + $this->setQuad($quad); + } + if (!is_null($entry)) { + $this->setEntry($entry); + } + if (!is_null($default)) { + $this->setDefault($default); + } $this->setEnabledDesign(CheckBoxDesign::defaultEnabledDesign()); $this->setDisabledDesign(CheckBoxDesign::defaultDisabledDesign()); } @@ -58,14 +64,10 @@ class CheckBoxFeature extends ScriptFeature { * Set the CheckBox Quad * * @param Quad $quad CheckBox Quad - * @return \FML\Script\Features\CheckBoxFeature + * @return \FML\Script\Features\CheckBoxFeature|static */ - public function setQuad(Quad $quad = null) { - if ($quad) { - $quad->checkId(); - $quad->setScriptEvents(true); - } - $this->quad = $quad; + public function setQuad(Quad $quad) { + $this->quad = $quad->checkId()->setScriptEvents(true); return $this; } @@ -82,13 +84,10 @@ class CheckBoxFeature extends ScriptFeature { * Set the CheckBox Entry * * @param Entry $entry CheckBox Entry - * @return \FML\Script\Features\CheckBoxFeature + * @return \FML\Script\Features\CheckBoxFeature|static */ - public function setEntry(Entry $entry = null) { - if ($entry) { - $entry->checkId(); - } - $this->entry = $entry; + public function setEntry(Entry $entry) { + $this->entry = $entry->checkId(); return $this; } @@ -102,10 +101,10 @@ class CheckBoxFeature extends ScriptFeature { } /** - * Set the default Value + * Set the default value * - * @param bool $default Default Value - * @return \FML\Script\Features\CheckBoxFeature + * @param bool $default Default value + * @return \FML\Script\Features\CheckBoxFeature|static */ public function setDefault($default) { $this->default = (bool)$default; @@ -113,10 +112,10 @@ class CheckBoxFeature extends ScriptFeature { } /** - * Set the Enabled Design + * Set the enabled Design * * @param CheckBoxDesign $checkBoxDesign Enabled CheckBox Design - * @return \FML\Script\Features\CheckBoxFeature + * @return \FML\Script\Features\CheckBoxFeature|static */ public function setEnabledDesign(CheckBoxDesign $checkBoxDesign) { $this->enabledDesign = $checkBoxDesign; @@ -124,10 +123,10 @@ class CheckBoxFeature extends ScriptFeature { } /** - * Set the Disabled Design + * Set the disabled Design * * @param CheckBoxDesign $checkBoxDesign Disabled CheckBox Design - * @return \FML\Script\Features\CheckBoxFeature + * @return \FML\Script\Features\CheckBoxFeature|static */ public function setDisabledDesign(CheckBoxDesign $checkBoxDesign) { $this->disabledDesign = $checkBoxDesign; @@ -148,12 +147,12 @@ class CheckBoxFeature extends ScriptFeature { } /** - * Build the Function Text + * Build the function text * * @return string */ protected function buildUpdateQuadDesignFunction() { - $functionText = " + return " Void " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(CMlQuad _Quad) { declare " . self::VAR_CHECKBOX_ENABLED . " as Enabled for _Quad = True; Enabled = !Enabled; @@ -167,8 +166,8 @@ Void " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(CMlQuad _Quad) { } else { _Quad.ImageUrl = Design; } - declare " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for _Quad = \"\"; - if (EntryId != \"\") { + declare " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for _Quad = " . Builder::EMPTY_STRING . "; + if (EntryId != " . Builder::EMPTY_STRING . ") { declare Value = \"0\"; if (Enabled) { Value = \"1\"; @@ -177,49 +176,46 @@ Void " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(CMlQuad _Quad) { Entry.Value = Value; } }"; - return $functionText; } /** - * Build the Init Script Text + * Build the init script text * * @return string */ protected function buildInitScriptText() { - $quadId = $this->getQuad()->getId(true); - $entryId = ''; + $quadId = $this->getQuad()->getId(true, true); + $entryId = '""'; if ($this->entry) { - $entryId = $this->entry->getId(true); + $entryId = $this->entry->getId(true, true); } $default = Builder::getBoolean($this->default); $enabledDesignString = $this->enabledDesign->getDesignString(); $disabledDesignString = $this->disabledDesign->getDesignString(); - $scriptText = " -declare Quad_CheckBox <=> (Page.GetFirstChild(\"{$quadId}\") as CMlQuad); + return " +declare Quad_CheckBox <=> (Page.GetFirstChild({$quadId}) as CMlQuad); declare Text[Boolean] " . self::VAR_CHECKBOX_DESIGNS . " as Designs for Quad_CheckBox; -Designs[True] = \"{$enabledDesignString}\"; -Designs[False] = \"{$disabledDesignString}\"; +Designs[True] = {$enabledDesignString}; +Designs[False] = {$disabledDesignString}; declare Boolean " . self::VAR_CHECKBOX_ENABLED . " as Enabled for Quad_CheckBox; Enabled = !{$default}; declare Text " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for Quad_CheckBox; -EntryId = \"{$entryId}\"; +EntryId = {$entryId}; " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox); "; - return $scriptText; } /** - * Build the Script Text for Quad Clicks + * Build the script text for Quad clicks * * @return string */ protected function buildClickScriptText() { - $quadId = $this->getQuad()->getId(true); - $scriptText = " -if (Event.ControlId == \"{$quadId}\") { + $quadId = $this->getQuad()->getId(true, true); + return " +if (Event.ControlId == {$quadId}) { declare Quad_CheckBox <=> (Event.Control as CMlQuad); " . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox); }"; - return $scriptText; } } diff --git a/application/core/Libs/FML/Script/Features/Clock.php b/application/core/Libs/FML/Script/Features/Clock.php index 75e8b624..02aa2f81 100644 --- a/application/core/Libs/FML/Script/Features/Clock.php +++ b/application/core/Libs/FML/Script/Features/Clock.php @@ -8,7 +8,7 @@ use FML\Script\ScriptInclude; use FML\Script\ScriptLabel; /** - * Script Feature showing the current Time on a Label + * Script Feature showing the current time on a Label * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -16,7 +16,7 @@ use FML\Script\ScriptLabel; */ class Clock extends ScriptFeature { /* - * Protected Properties + * Protected properties */ /** @var Label $label */ protected $label = null; @@ -27,11 +27,13 @@ class Clock extends ScriptFeature { * Construct a new Clock Feature * * @param Label $label (optional) Clock Label - * @param bool $showSeconds (optional) Whether the Seconds should be shown - * @param bool $showFullDate (optional) Whether the Date should be shown + * @param bool $showSeconds (optional) Whether the seconds should be shown + * @param bool $showFullDate (optional) Whether the date should be shown */ public function __construct(Label $label = null, $showSeconds = true, $showFullDate = false) { - $this->setLabel($label); + if (!is_null($label)) { + $this->setLabel($label); + } $this->setShowSeconds($showSeconds); $this->setShowFullDate($showFullDate); } @@ -40,19 +42,18 @@ class Clock extends ScriptFeature { * Set the Label * * @param Label $label Clock Label - * @return \FML\Script\Features\Clock + * @return \FML\Script\Features\Clock|static */ public function setLabel(Label $label) { - $label->checkId(); - $this->label = $label; + $this->label = $label->checkId(); return $this; } /** - * Set whether the Seconds should be shown + * Set whether seconds should be shown * - * @param bool $showSeconds Whether the Seconds should be shown - * @return \FML\Script\Features\Clock + * @param bool $showSeconds Whether seconds should be shown + * @return \FML\Script\Features\Clock|static */ public function setShowSeconds($showSeconds) { $this->showSeconds = (bool)$showSeconds; @@ -60,10 +61,10 @@ class Clock extends ScriptFeature { } /** - * Set whether the Full Date should be shown + * Set whether the full date should be shown * - * @param bool $showFullDate Whether the Full Date should be shown - * @return \FML\Script\Features\Clock + * @param bool $showFullDate Whether the full date should be shown + * @return \FML\Script\Features\Clock|static */ public function setShowFullDate($showFullDate) { $this->showFullDate = (bool)$showFullDate; @@ -80,14 +81,14 @@ class Clock extends ScriptFeature { } /** - * Get the Script Text + * Get the script text * * @return string */ protected function getScriptText() { - $controlId = $this->label->getId(true); + $controlId = $this->label->getId(true, true); $scriptText = " -declare ClockLabel <=> (Page.GetFirstChild(\"{$controlId}\") as CMlLabel); +declare ClockLabel <=> (Page.GetFirstChild({$controlId}) as CMlLabel); declare TimeText = CurrentLocalDateText;"; if (!$this->showSeconds) { $scriptText .= " diff --git a/application/core/Libs/FML/Script/Features/ControlScript.php b/application/core/Libs/FML/Script/Features/ControlScript.php index 3036b413..9f3a6984 100644 --- a/application/core/Libs/FML/Script/Features/ControlScript.php +++ b/application/core/Libs/FML/Script/Features/ControlScript.php @@ -8,7 +8,7 @@ use FML\Script\ScriptLabel; use FML\Types\Scriptable; /** - * Script Feature for a Control-related Script + * Script Feature for a Control related script * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -16,7 +16,7 @@ use FML\Types\Scriptable; */ class ControlScript extends ScriptFeature { /* - * Protected Properties + * Protected properties */ /** @var Control $control */ protected $control = null; @@ -24,11 +24,11 @@ class ControlScript extends ScriptFeature { protected $text = null; /** - * Construct a new Custom Script Text + * Construct a new Control Script * * @param Control $control Event Control - * @param string $text Script Text - * @param string $labelName (optional) Script Label Name + * @param string $text Script text + * @param string $labelName (optional) Script Label name */ public function __construct(Control $control, $text, $labelName = ScriptLabel::MOUSECLICK) { $this->setControl($control); @@ -39,21 +39,20 @@ class ControlScript extends ScriptFeature { /** * Set the Control * - * @param Control $control Custom Control - * @return \FML\Script\Features\ControlScript + * @param Control $control Event Control + * @return \FML\Script\Features\ControlScript|static */ public function setControl(Control $control) { - $control->checkId(); - $this->control = $control; + $this->control = $control->checkId(); $this->updateScriptEvents(); return $this; } /** - * Set the Script Text + * Set the script text * - * @param string $text Script Text - * @return \FML\Script\Features\ControlScript + * @param string $text Script text + * @return \FML\Script\Features\ControlScript|static */ public function setText($text) { $this->text = (string)$text; @@ -61,13 +60,13 @@ class ControlScript extends ScriptFeature { } /** - * Set the Label Name + * Set the label name * - * @param string $labelName Script Label Name - * @return \FML\Script\Features\ControlScript + * @param string $labelName Script Label name + * @return \FML\Script\Features\ControlScript|static */ public function setLabelName($labelName) { - $this->labelName = $labelName; + $this->labelName = (string)$labelName; $this->updateScriptEvents(); return $this; } @@ -76,10 +75,7 @@ class ControlScript extends ScriptFeature { * Enable Script Events on the Control if needed */ protected function updateScriptEvents() { - if (!$this->control) { - return; - } - if (!ScriptLabel::isEventLabel($this->labelName)) { + if (!$this->control || !ScriptLabel::isEventLabel($this->labelName)) { return; } if ($this->control instanceof Scriptable) { @@ -97,7 +93,7 @@ class ControlScript extends ScriptFeature { } /** - * Build the Script Text for the Control + * Build the script text for the Control * * @return string */ @@ -105,7 +101,6 @@ class ControlScript extends ScriptFeature { $controlId = $this->control->getId(true); $scriptText = ''; $closeBlock = false; - if (ScriptLabel::isEventLabel($this->labelName)) { $scriptText .= ' if (Event.ControlId == "' . $controlId . '") { @@ -115,20 +110,16 @@ declare Control <=> Event.Control;'; $scriptText .= ' declare Control <=> Page.GetFirstChild("' . $controlId . '");'; } - $class = $this->control->getManiaScriptClass(); $name = preg_replace('/^CMl/', '', $class, 1); $scriptText .= ' declare ' . $name . ' <=> (Control as ' . $class . '); '; - $scriptText .= $this->text . ' '; - if ($closeBlock) { $scriptText .= '}'; } - return $scriptText; } } diff --git a/application/core/Libs/FML/Script/Features/EntrySubmit.php b/application/core/Libs/FML/Script/Features/EntrySubmit.php index 5855c810..3fe7f3ce 100644 --- a/application/core/Libs/FML/Script/Features/EntrySubmit.php +++ b/application/core/Libs/FML/Script/Features/EntrySubmit.php @@ -17,7 +17,7 @@ use FML\Script\ScriptLabel; */ class EntrySubmit extends ScriptFeature { /* - * Protected Properties + * Protected properties */ /** @var Entry $entry */ protected $entry = null; @@ -27,10 +27,12 @@ class EntrySubmit extends ScriptFeature { * Construct a new Entry Submit Feature * * @param Entry $entry (optional) Entry Control - * @param string $url (optional) Submit Url + * @param string $url (optional) Submit url */ public function __construct(Entry $entry = null, $url = null) { - $this->setEntry($entry); + if (!is_null($entry)) { + $this->setEntry($entry); + } $this->setUrl($url); } @@ -38,20 +40,18 @@ class EntrySubmit extends ScriptFeature { * Set the Entry * * @param Entry $entry Entry Control - * @return \FML\Script\Features\EntrySubmit + * @return \FML\Script\Features\EntrySubmit|static */ public function setEntry(Entry $entry) { - $entry->checkId(); - $entry->setScriptEvents(true); - $this->entry = $entry; + $this->entry = $entry->checkId()->setScriptEvents(true); return $this; } /** - * Set the Submit Url + * Set the submit url * - * @param string $url Submit Url - * @return \FML\Script\Features\EntrySubmit + * @param string $url Submit url + * @return \FML\Script\Features\EntrySubmit|static */ public function setUrl($url) { $this->url = (string)$url; @@ -69,22 +69,22 @@ class EntrySubmit extends ScriptFeature { } /** - * Get the Script Text + * Get the script text * * @return string */ protected function getScriptText() { - $url = $this->buildCompatibleUrl(); - $entryName = Builder::escapeText($this->entry->getName()); - $scriptText = " + $url = $this->buildCompatibleUrl(); + $entryName = $this->entry->getName(); + $link = Builder::escapeText($entryName . $url . '=', true); + return " declare Value = TextLib::URLEncode(Entry.Value); -OpenLink(\"{$url}{$entryName}=\"^Value, CMlScript::LinkType::Goto); +OpenLink({$link}^Value, CMlScript::LinkType::Goto); "; - return $scriptText; } /** - * Build the Submit Url compatible for the Entry Parameter + * Build the submit url compatible for the Entry parameter * * @return string */ diff --git a/application/core/Libs/FML/Script/Features/KeyAction.php b/application/core/Libs/FML/Script/Features/KeyAction.php index cdb48711..9ea3655b 100644 --- a/application/core/Libs/FML/Script/Features/KeyAction.php +++ b/application/core/Libs/FML/Script/Features/KeyAction.php @@ -7,7 +7,7 @@ use FML\Script\Script; use FML\Script\ScriptLabel; /** - * Script Feature for triggering a Page Action on Key Press + * Script Feature for triggering a manialink page action on key press * * @author steeffeen * @link http://destroflyer.mania-community.de/maniascript/keycharid_table.php @@ -16,7 +16,7 @@ use FML\Script\ScriptLabel; */ class KeyAction extends ScriptFeature { /* - * Protected Properties + * Protected properties */ protected $actionName = null; protected $keyName = null; @@ -26,23 +26,23 @@ class KeyAction extends ScriptFeature { /** * Construct a new Key Action Feature * - * @param string $actionName (optional) Triggered Action - * @param string $keyName (optional) Key Name - * @param int $keyCode (optional) Key Code - * @param string $charPressed (optional) Pressed Char + * @param string $actionName (optional) Triggered action + * @param string $keyName (optional) Key name */ - public function __construct($actionName = null, $keyName = null, $keyCode = null, $charPressed = null) { - $this->setActionName($actionName); - $this->setKeyName($keyName); - $this->setKeyCode($keyCode); - $this->setCharPressed($charPressed); + public function __construct($actionName = null, $keyName = null) { + if (!is_null($actionName)) { + $this->setActionName($actionName); + } + if (!is_null($keyName)) { + $this->setKeyName($keyName); + } } /** - * Set the Action to trigger + * Set the action to trigger * - * @param string $actionName Triggered Action - * @return \FML\Script\Features\KeyAction + * @param string $actionName Triggered action + * @return \FML\Script\Features\KeyAction|static */ public function setActionName($actionName) { $this->actionName = (string)$actionName; @@ -50,35 +50,41 @@ class KeyAction extends ScriptFeature { } /** - * Set the Key Name for triggering the Action + * Set the key name for triggering the action * * @param string $keyName Key Name - * @return \FML\Script\Features\KeyAction + * @return \FML\Script\Features\KeyAction|static */ public function setKeyName($keyName) { - $this->keyName = (string)$keyName; + $this->keyName = (string)$keyName; + $this->keyCode = null; + $this->charPressed = null; return $this; } /** - * Set the Key Code for triggering the Action + * Set the key code for triggering the action * * @param int $keyCode Key Code - * @return \FML\Script\Features\KeyAction + * @return \FML\Script\Features\KeyAction|static */ public function setKeyCode($keyCode) { - $this->keyCode = $keyCode; + $this->keyCode = (int)$keyCode; + $this->keyName = null; + $this->charPressed = null; return $this; } /** - * Set the Char to press for triggering the Action + * Set the char to press for triggering the action * - * @param string $charPressed Pressed Char - * @return \FML\Script\Features\KeyAction + * @param string $charPressed Pressed char + * @return \FML\Script\Features\KeyAction|static */ public function setCharPressed($charPressed) { - $this->charPressed = $charPressed; + $this->charPressed = (string)$charPressed; + $this->keyName = null; + $this->keyCode = null; return $this; } @@ -91,25 +97,28 @@ class KeyAction extends ScriptFeature { } /** - * Get the Script Text + * Get the script text * * @return string */ protected function getScriptText() { - $actionName = Builder::escapeText($this->actionName); - $key = 'KeyName'; - $value = $this->keyName; - if ($this->keyCode !== null) { + $actionName = Builder::escapeText($this->actionName, true); + $key = null; + $value = null; + if (!is_null($this->keyName)) { + $key = 'KeyName'; + $value = $this->keyName; + } else if (!is_null($this->keyCode)) { $key = 'KeyCode'; - $value = (int)$this->keyCode; - } else if ($this->charPressed !== null) { + $value = $this->keyCode; + } else if (!is_null($this->charPressed)) { $key = 'CharPressed'; - $value = (string)$this->charPressed; + $value = $this->charPressed; } - $scriptText = " -if (Event.{$key} == \"{$value}\") { - TriggerPageAction(\"{$actionName}\"); + $value = Builder::escapeText($value, true); + return " +if (Event.{$key} == {$value}) { + TriggerPageAction({$actionName}); }"; - return $scriptText; } } diff --git a/application/core/Libs/FML/Script/Features/MapInfo.php b/application/core/Libs/FML/Script/Features/MapInfo.php index df6f0f16..3563470e 100644 --- a/application/core/Libs/FML/Script/Features/MapInfo.php +++ b/application/core/Libs/FML/Script/Features/MapInfo.php @@ -9,7 +9,7 @@ use FML\Script\ScriptLabel; use FML\Types\Scriptable; /** - * Script Feature for opening the Map Info + * Script Feature for opening the map info * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -17,7 +17,7 @@ use FML\Types\Scriptable; */ class MapInfo extends ScriptFeature { /* - * Protected Properties + * Protected properties */ /** @var Control $control */ protected $control = null; @@ -27,7 +27,7 @@ class MapInfo extends ScriptFeature { * Construct a new Map Info Feature * * @param Control $control (optional) Map Info Control - * @param string $labelName (optional) Script Label Name + * @param string $labelName (optional) Script Label name */ public function __construct(Control $control, $labelName = ScriptLabel::MOUSECLICK) { $this->setControl($control); @@ -38,7 +38,7 @@ class MapInfo extends ScriptFeature { * Set the Control * * @param Control $control Map Info Control - * @return \FML\Script\Features\MapInfo + * @return \FML\Script\Features\MapInfo|static */ public function setControl(Control $control) { $control->checkId(); @@ -50,13 +50,13 @@ class MapInfo extends ScriptFeature { } /** - * Set the Label Name + * Set the label name * - * @param string $labelName Script Label Name - * @return \FML\Script\Features\MapInfo + * @param string $labelName Script Label name + * @return \FML\Script\Features\MapInfo|static */ public function setLabelName($labelName) { - $this->labelName = $labelName; + $this->labelName = (string)$labelName; return $this; } @@ -69,16 +69,16 @@ class MapInfo extends ScriptFeature { } /** - * Get the Script Text + * Get the script text * * @return string */ protected function getScriptText() { if ($this->control) { // Control event - $controlId = Builder::escapeText($this->control->getId()); + $controlId = Builder::escapeText($this->control->getId(), true); $scriptText = " -if (Event.Control.ControlId == \"{$controlId}\") { +if (Event.Control.ControlId == {$controlId}) { ShowCurChallengeCard(); }"; } else { diff --git a/application/core/Libs/FML/Script/Features/Menu.php b/application/core/Libs/FML/Script/Features/Menu.php index a981c43c..98113017 100644 --- a/application/core/Libs/FML/Script/Features/Menu.php +++ b/application/core/Libs/FML/Script/Features/Menu.php @@ -8,7 +8,7 @@ use FML\Script\Script; use FML\Script\ScriptLabel; /** - * Script Feature realising a Menu showing specific Controls for the different Item Controls + * Script Feature realising a Menu showing specific Controls for the different items * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -21,8 +21,9 @@ class Menu extends ScriptFeature { const FUNCTION_UPDATE_MENU = 'FML_UpdateMenu'; /* - * Protected Properties + * Protected properties */ + /** @var MenuElement[] $elements */ protected $elements = array(); /** @var MenuElement $startElement */ protected $startElement = null; @@ -30,7 +31,7 @@ class Menu extends ScriptFeature { /** * Construct a new Menu Feature * - * @param Control $item (optional) Item Control in the Menu Bar + * @param Control $item (optional) Item Control in the Menu bar * @param Control $control (optional) Toggled Menu Control */ public function __construct(Control $item = null, Control $control = null) { @@ -42,10 +43,10 @@ class Menu extends ScriptFeature { /** * Add a new Element to the Menu * - * @param Control $item Item Control in the Menu Bar + * @param Control $item Item Control in the Menu bar * @param Control $control Toggled Menu Control * @param bool $isStartElement (optional) Whether the Menu should start with this Element - * @return \FML\Script\Features\Menu + * @return \FML\Script\Features\Menu|static */ public function addElement(Control $item, Control $control, $isStartElement = false) { $menuElement = new MenuElement($item, $control); @@ -58,14 +59,16 @@ class Menu extends ScriptFeature { * * @param MenuElement $menuElement Menu Element * @param bool $isStartElement (optional) Whether the Menu should start with this Element - * @return \FML\Script\Features\Menu + * @return \FML\Script\Features\Menu|static */ public function appendElement(MenuElement $menuElement, $isStartElement = false) { - array_push($this->elements, $menuElement); - if ($isStartElement) { - $this->setStartElement($menuElement); - } else if (count($this->elements) > 1) { - $menuElement->getControl()->setVisible(false); + if (!in_array($menuElement, $this->elements, true)) { + array_push($this->elements, $menuElement); + if ($isStartElement) { + $this->setStartElement($menuElement); + } else if (count($this->elements) > 1) { + $menuElement->getControl()->setVisible(false); + } } return $this; } @@ -74,7 +77,7 @@ class Menu extends ScriptFeature { * Set the Element to start with * * @param MenuElement $startElement Starting Element - * @return \FML\Script\Features\Menu + * @return \FML\Script\Features\Menu|static */ public function setStartElement(MenuElement $startElement) { $this->startElement = $startElement; @@ -93,9 +96,9 @@ class Menu extends ScriptFeature { // OnInit if ($this->startElement) { - $startControlId = $this->startElement->getControl()->getId(true); + $startControlId = $this->startElement->getControl()->getId(true, true); $initScriptText = " -{$updateFunctionName}({$elementsArrayText}, \"{$startControlId}\");"; +{$updateFunctionName}({$elementsArrayText}, {$startControlId});"; $script->appendGenericScriptLabel(ScriptLabel::ONINIT, $initScriptText, true); } @@ -122,14 +125,13 @@ Void {$updateFunctionName}(Text[Text] _Elements, Text _ShownControlId) { } /** - * Build the Array Text for the Elements + * Build the array text for the Elements * * @return string */ protected function getElementsArrayText() { $elements = array(); foreach ($this->elements as $element) { - /** @var MenuElement $element */ $elementId = $element->getItem()->getId(); $elements[$elementId] = $element->getControl()->getId(); } diff --git a/application/core/Libs/FML/Script/Features/MenuElement.php b/application/core/Libs/FML/Script/Features/MenuElement.php index 2bd642ee..6ef6ebe0 100644 --- a/application/core/Libs/FML/Script/Features/MenuElement.php +++ b/application/core/Libs/FML/Script/Features/MenuElement.php @@ -6,7 +6,7 @@ use FML\Controls\Control; use FML\Types\Scriptable; /** - * An Element for the Menu Feature + * Menu Element for the Menu Feature * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -14,7 +14,7 @@ use FML\Types\Scriptable; */ class MenuElement { /* - * Protected Properties + * Protected properties */ protected $item = null; protected $control = null; @@ -22,19 +22,23 @@ class MenuElement { /** * Create a new Menu Element * - * @param Control $item (optional) Item Control in the Menu Bar + * @param Control $item (optional) Item Control in the Menu bar * @param Control $control (optional) Toggled Menu Control */ public function __construct(Control $item = null, Control $control = null) { - $this->setItem($item); - $this->setControl($control); + if (!is_null($item)) { + $this->setItem($item); + } + if (!is_null($control)) { + $this->setControl($control); + } } /** * Set the Item Control * - * @param Control $item Item Control in the Menu Bar - * @return \FML\Script\Features\MenuElement + * @param Control $item Item Control in the Menu bar + * @return \FML\Script\Features\MenuElement|static */ public function setItem(Control $item) { $item->checkId(); @@ -58,11 +62,10 @@ class MenuElement { * Set the Menu Control * * @param Control $control Toggled Menu Control - * @return \FML\Script\Features\MenuElement + * @return \FML\Script\Features\MenuElement|static */ public function setControl(Control $control) { - $control->checkId(); - $this->control = $control; + $this->control = $control->checkId(); return $this; } diff --git a/application/core/Libs/FML/Script/Features/Paging.php b/application/core/Libs/FML/Script/Features/Paging.php index e6681508..b04ed239 100644 --- a/application/core/Libs/FML/Script/Features/Paging.php +++ b/application/core/Libs/FML/Script/Features/Paging.php @@ -10,7 +10,7 @@ use FML\Script\ScriptInclude; use FML\Script\ScriptLabel; /** - * Script Feature realising a Mechanism for browsing through Pages + * Script Feature realising a mechanism for browsing through Pages * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -24,9 +24,11 @@ class Paging extends ScriptFeature { const FUNCTION_UPDATE_CURRENT_PAGE = 'FML_UpdateCurrentPage'; /* - * Protected Properties + * Protected properties */ + /** @var PagingPage[] $pages */ protected $pages = array(); + /** @var PagingButton[] $buttons */ protected $buttons = array(); /** @var Label $label */ protected $label = null; @@ -39,10 +41,10 @@ class Paging extends ScriptFeature { /** * Construct a new Paging Script Feature * - * @param Label $label (optional) Page Number Label + * @param Label $label (optional) Page number Label */ public function __construct(Label $label = null) { - if ($label) { + if (!is_null($label)) { $this->setLabel($label); } } @@ -51,11 +53,11 @@ class Paging extends ScriptFeature { * Add a new Page Control * * @param Control $pageControl Page Control - * @param string $pageNumber (optional) Page Number - * @return \FML\Script\Features\Paging + * @param string $pageNumber (optional) Page number + * @return \FML\Script\Features\Paging|static */ public function addPage(Control $pageControl, $pageNumber = null) { - if ($pageNumber === null) { + if (is_null($pageNumber)) { $pageNumber = count($this->pages) + 1; } $page = new PagingPage($pageControl, $pageNumber); @@ -67,22 +69,24 @@ class Paging extends ScriptFeature { * Append a Page * * @param PagingPage $page Paging Page - * @return \FML\Script\Features\Paging + * @return \FML\Script\Features\Paging|static */ public function appendPage(PagingPage $page) { - array_push($this->pages, $page); + if (!in_array($page, $this->pages, true)) { + array_push($this->pages, $page); + } return $this; } /** * Add a new Button to browse through the Pages * - * @param Control $buttonControl Button used for Browsing - * @param int $browseAction (optional) Number of browsed Pages per Click - * @return \FML\Script\Features\Paging + * @param Control $buttonControl Button used for browsing + * @param int $browseAction (optional) Number of browsed Pages per click + * @return \FML\Script\Features\Paging|static */ public function addButton(Control $buttonControl, $browseAction = null) { - if ($browseAction === null) { + if (is_null($browseAction)) { $buttonCount = count($this->buttons); if ($buttonCount % 2 === 0) { $browseAction = $buttonCount / 2 + 1; @@ -99,40 +103,41 @@ class Paging extends ScriptFeature { * Append a Button to browse through Pages * * @param PagingButton $button Paging Button - * @return \FML\Script\Features\Paging + * @return \FML\Script\Features\Paging|static */ public function appendButton(PagingButton $button) { - array_push($this->buttons, $button); + if (!in_array($button, $this->buttons, true)) { + array_push($this->buttons, $button); + } return $this; } /** - * Set the Label showing the Page Number + * Set the Label showing the Page number * - * @param Label $label Page Number Label - * @return \FML\Script\Features\Paging + * @param Label $label Page number Label + * @return \FML\Script\Features\Paging|static */ public function setLabel(Label $label) { - $label->checkId(); - $this->label = $label; + $this->label = $label->checkId(); return $this; } /** - * Set the Start Page Number + * Set the Start Page number * - * @param int $startPageNumber Page Number to start with - * @return \FML\Script\Features\Paging + * @param int $startPageNumber Page number to start with + * @return \FML\Script\Features\Paging|static */ public function setStartPageNumber($startPageNumber) { $this->startPageNumber = (int)$startPageNumber; } /** - * Set a custom Maximum Page Number for using Chunks + * Set a custom maximum Page number for using chunks * - * @param int $maxPageNumber Custom Maximum Page Number - * @return \FML\Script\Features\Paging + * @param int $maxPageNumber Custom maximum Page number + * @return \FML\Script\Features\Paging|static */ public function setCustomMaxPageNumber($maxPageNumber) { $this->customMaxPageNumber = (int)$maxPageNumber; @@ -140,10 +145,10 @@ class Paging extends ScriptFeature { } /** - * Set the Action triggered when the previous Chunk is needed + * Set the action triggered when the previous chunk is needed * - * @param string $previousChunkAction Triggered Action - * @return \FML\Script\Features\Paging + * @param string $previousChunkAction Triggered action + * @return \FML\Script\Features\Paging|static */ public function setPreviousChunkAction($previousChunkAction) { $this->previousChunkAction = (string)$previousChunkAction; @@ -151,10 +156,10 @@ class Paging extends ScriptFeature { } /** - * Set the Action triggered when the next Chunk is needed + * Set the action triggered when the next chunk is needed * - * @param string $nextChunkAction Triggered Action - * @return \FML\Script\Features\Paging + * @param string $nextChunkAction Triggered action + * @return \FML\Script\Features\Paging|static */ public function setNextChunkAction($nextChunkAction) { $this->nextChunkAction = (string)$nextChunkAction; @@ -162,10 +167,10 @@ class Paging extends ScriptFeature { } /** - * Set the Actions triggered when another Chunk is needed + * Set the actions triggered when another chunk is needed * - * @param string $chunkAction Triggered Action - * @return \FML\Script\Features\Paging + * @param string $chunkAction Triggered action + * @return \FML\Script\Features\Paging|static */ public function setChunkActions($chunkAction) { $this->setNextChunkAction($chunkAction); @@ -174,10 +179,10 @@ class Paging extends ScriptFeature { } /** - * Set if the Chunk Action should get the needed Page Number appended + * Set if the chunk action should get the needed Page number appended * - * @param bool $appendPageNumber Whether to append the needed Page Number - * @return \FML\Script\Features\Paging + * @param bool $appendPageNumber Whether to append the needed Page number + * @return \FML\Script\Features\Paging|static */ public function setChunkActionAppendsPageNumber($appendPageNumber) { $this->chunkActionAppendsPageNumber = (bool)$appendPageNumber; @@ -188,7 +193,7 @@ class Paging extends ScriptFeature { * @see \FML\Script\Features\ScriptFeature::prepare() */ public function prepare(Script $script) { - if (!$this->pages) { + if (empty($this->pages)) { return $this; } $script->setScriptInclude(ScriptInclude::TEXTLIB); @@ -204,23 +209,23 @@ class Paging extends ScriptFeature { $maxPageNumber = $maxPage->getPageNumber(); } - $pagingId = $maxPage->getControl()->getId(true); - $pageLabelId = ''; + $pagingId = $maxPage->getControl()->getId(true, true); + $pageLabelId = '""'; if ($this->label) { - $pageLabelId = $this->label->getId(true); + $pageLabelId = $this->label->getId(true, true); } $pagesArrayText = $this->getPagesArrayText(); $pageButtonsArrayText = $this->getPageButtonsArrayText(); - $previousChunkAction = Builder::escapeText($this->previousChunkAction); - $nextChunkAction = Builder::escapeText($this->nextChunkAction); + $previousChunkAction = Builder::escapeText($this->previousChunkAction, true); + $nextChunkAction = Builder::escapeText($this->nextChunkAction, true); $chunkActionAppendsPageNumber = Builder::getBoolean($this->chunkActionAppendsPageNumber); // Init $initScriptText = " declare {$currentPageVariable} for This = Integer[Text]; -{$currentPageVariable}[\"{$pagingId}\"] = {$startPageNumber}; -{$updatePageFunction}(\"{$pagingId}\", \"{$pageLabelId}\", 0, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, \"{$previousChunkAction}\", \"{$nextChunkAction}\", {$chunkActionAppendsPageNumber});"; +{$currentPageVariable}[{$pagingId}] = {$startPageNumber}; +{$updatePageFunction}({$pagingId}, {$pageLabelId}, 0, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, {$previousChunkAction}, {$nextChunkAction}, {$chunkActionAppendsPageNumber});"; $script->appendGenericScriptLabel(ScriptLabel::ONINIT, $initScriptText, true); // MouseClick @@ -228,7 +233,7 @@ declare {$currentPageVariable} for This = Integer[Text]; declare PageButtons = {$pageButtonsArrayText}; if (PageButtons.existskey(Event.Control.ControlId)) { declare BrowseAction = PageButtons[Event.Control.ControlId]; - {$updatePageFunction}(\"{$pagingId}\", \"{$pageLabelId}\", BrowseAction, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, \"{$previousChunkAction}\", \"{$nextChunkAction}\", {$chunkActionAppendsPageNumber}); + {$updatePageFunction}({$pagingId}, {$pageLabelId}, BrowseAction, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, {$previousChunkAction}, {$nextChunkAction}, {$chunkActionAppendsPageNumber}); }"; $script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $clickScriptText, true); @@ -264,7 +269,7 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct } TriggerPageAction(ChunkAction); } - if (_PageLabelId == \"\") return; + if (_PageLabelId == " . Builder::EMPTY_STRING . ") return; declare PageLabel <=> (Page.GetFirstChild(_PageLabelId) as CMlLabel); if (PageLabel == Null) return; PageLabel.Value = CurrentPage^\"/\"^_MaxPageNumber; @@ -282,9 +287,8 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct $minPageNumber = null; $minPage = null; foreach ($this->pages as $page) { - /** @var PagingPage $page */ $pageNumber = $page->getPageNumber(); - if ($minPageNumber === null || $pageNumber < $minPageNumber) { + if (is_null($minPageNumber) || $pageNumber < $minPageNumber) { $minPageNumber = $pageNumber; $minPage = $page; } @@ -301,9 +305,8 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct $maxPageNumber = null; $maxPage = null; foreach ($this->pages as $page) { - /** @var PagingPage $page */ $pageNumber = $page->getPageNumber(); - if ($maxPageNumber === null || $pageNumber > $maxPageNumber) { + if (is_null($maxPageNumber) || $pageNumber > $maxPageNumber) { $maxPageNumber = $pageNumber; $maxPage = $page; } @@ -312,34 +315,33 @@ Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAct } /** - * Build the Array Text for the Pages + * Build the array text for the Pages * * @return string */ protected function getPagesArrayText() { + if (empty($this->pages)) { + return Builder::getArray(array(0 => ''), true); + } $pages = array(); foreach ($this->pages as $page) { - /** @var PagingPage $page */ - $pageNumber = $page->getPageNumber(); - $pages[$pageNumber] = $page->getControl()->getId(); + $pages[$page->getPageNumber()] = $page->getControl()->getId(); } return Builder::getArray($pages, true); } /** - * Build the Array Text for the Page Buttons + * Build the array text for the Page Buttons * * @return string */ protected function getPageButtonsArrayText() { - if (!$this->buttons) { - return Builder::getArray(array("" => 0), true); + if (empty($this->buttons)) { + return Builder::getArray(array('' => 0), true); } $pageButtons = array(); foreach ($this->buttons as $pageButton) { - /** @var PagingButton $pageButton */ - $pageButtonId = $pageButton->getControl()->getId(); - $pageButtons[$pageButtonId] = $pageButton->getBrowseAction(); + $pageButtons[$pageButton->getControl()->getId()] = $pageButton->getBrowseAction(); } return Builder::getArray($pageButtons, true); } diff --git a/application/core/Libs/FML/Script/Features/PagingButton.php b/application/core/Libs/FML/Script/Features/PagingButton.php index 142bddcb..b2e62b66 100644 --- a/application/core/Libs/FML/Script/Features/PagingButton.php +++ b/application/core/Libs/FML/Script/Features/PagingButton.php @@ -6,7 +6,7 @@ use FML\Controls\Control; use FML\Types\Scriptable; /** - * A Button for browsing through Pages + * Paging Button for browsing through Pages * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -14,8 +14,9 @@ use FML\Types\Scriptable; */ class PagingButton { /* - * Protected Properties + * Protected properties */ + /** @var Control $control */ protected $control = null; protected $browseAction = null; @@ -26,15 +27,19 @@ class PagingButton { * @param int $browseAction (optional) Number of browsed Pages per Click */ public function __construct(Control $control = null, $browseAction = null) { - $this->setControl($control); - $this->setBrowseAction($browseAction); + if (!is_null($control)) { + $this->setControl($control); + } + if (!is_null($browseAction)) { + $this->setBrowseAction($browseAction); + } } /** * Set the Button Control * * @param Control $control Browse Control - * @return \FML\Script\Features\PagingButton + * @return \FML\Script\Features\PagingButton|static */ public function setControl(Control $control) { $control->checkId(); @@ -55,10 +60,10 @@ class PagingButton { } /** - * Set the Browse Action + * Set the browse action * - * @param int $browseAction Number of browsed Pages per Click - * @return \FML\Script\Features\PagingButton + * @param int $browseAction Number of browsed Pages per click + * @return \FML\Script\Features\PagingButton|static */ public function setBrowseAction($browseAction) { $this->browseAction = (int)$browseAction; @@ -66,7 +71,7 @@ class PagingButton { } /** - * Get the Browse Action + * Get the browse action * * @return int */ diff --git a/application/core/Libs/FML/Script/Features/PagingPage.php b/application/core/Libs/FML/Script/Features/PagingPage.php index d65d69e1..9c9804bc 100644 --- a/application/core/Libs/FML/Script/Features/PagingPage.php +++ b/application/core/Libs/FML/Script/Features/PagingPage.php @@ -5,7 +5,7 @@ namespace FML\Script\Features; use FML\Controls\Control; /** - * A Page Control + * Paging Page * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -13,8 +13,9 @@ use FML\Controls\Control; */ class PagingPage { /* - * Protected Properties + * Protected properties */ + /** @var Control $control */ protected $control = null; protected $number = null; @@ -25,7 +26,9 @@ class PagingPage { * @param int $pageNumber (optional) Number of the Page */ public function __construct(Control $control = null, $pageNumber = 1) { - $this->setControl($control); + if (!is_null($control)) { + $this->setControl($control); + } $this->setPageNumber($pageNumber); } @@ -33,11 +36,10 @@ class PagingPage { * Set the Page Control * * @param Control $control Page Control - * @return \FML\Script\Features\PagingPage + * @return \FML\Script\Features\PagingPage|static */ public function setControl(Control $control) { - $control->checkId(); - $this->control = $control; + $this->control = $control->checkId(); return $this; } @@ -51,10 +53,10 @@ class PagingPage { } /** - * Set the Page Number + * Set the Page number * * @param int $pageNumber Number of the Page - * @return \FML\Script\Features\PagingPage + * @return \FML\Script\Features\PagingPage|static */ public function setPageNumber($pageNumber) { $this->number = (int)$pageNumber; @@ -62,7 +64,7 @@ class PagingPage { } /** - * Get the Page Number + * Get the Page number * * @return int */ diff --git a/application/core/Libs/FML/Script/Features/PlayerProfile.php b/application/core/Libs/FML/Script/Features/PlayerProfile.php index 7a9ce52b..f88c0e1f 100644 --- a/application/core/Libs/FML/Script/Features/PlayerProfile.php +++ b/application/core/Libs/FML/Script/Features/PlayerProfile.php @@ -9,7 +9,7 @@ use FML\Script\ScriptLabel; use FML\Types\Scriptable; /** - * Script Feature for opening a Player Profile + * Script Feature for opening a player profile * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -17,7 +17,7 @@ use FML\Types\Scriptable; */ class PlayerProfile extends ScriptFeature { /* - * Protected Properties + * Protected properties */ protected $login = null; /** @var Control $control */ @@ -27,21 +27,23 @@ class PlayerProfile extends ScriptFeature { /** * Construct a new Player Profile Feature * - * @param string $login (optional) Player Login + * @param string $login (optional) Player login * @param Control $control (optional) Action Control - * @param string $labelName (optional) Script Label Name + * @param string $labelName (optional) Script Label name */ public function __construct($login = null, Control $control = null, $labelName = ScriptLabel::MOUSECLICK) { $this->setLogin($login); - $this->setControl($control); + if (!is_null($control)) { + $this->setControl($control); + } $this->setLabelName($labelName); } /** - * Set the Login of the Player + * Set the login of the opened player * - * @param string $login Player Login - * @return \FML\Script\Features\PlayerProfile + * @param string $login Player login + * @return \FML\Script\Features\PlayerProfile|static */ public function setLogin($login) { $this->login = $login; @@ -52,7 +54,7 @@ class PlayerProfile extends ScriptFeature { * Set the Control * * @param Control $control Profile Control - * @return \FML\Script\Features\PlayerProfile + * @return \FML\Script\Features\PlayerProfile|static */ public function setControl(Control $control) { $control->checkId(); @@ -64,13 +66,13 @@ class PlayerProfile extends ScriptFeature { } /** - * Set the Label Name + * Set the label name * - * @param string $labelName Script Label Name - * @return \FML\Script\Features\PlayerProfile + * @param string $labelName Script Label name + * @return \FML\Script\Features\PlayerProfile|static */ public function setLabelName($labelName) { - $this->labelName = $labelName; + $this->labelName = (string)$labelName; return $this; } @@ -83,23 +85,23 @@ class PlayerProfile extends ScriptFeature { } /** - * Get the Script Text + * Get the script text * * @return string */ protected function getScriptText() { - $login = Builder::escapeText($this->login); + $login = Builder::escapeText($this->login, true); if ($this->control) { // Control event - $controlId = Builder::escapeText($this->control->getId()); + $controlId = Builder::escapeText($this->control->getId(), true); $scriptText = " -if (Event.Control.ControlId == \"{$controlId}\") { - ShowProfile(\"{$login}\"); +if (Event.Control.ControlId == {$controlId}) { + ShowProfile({$login}); }"; } else { // Other $scriptText = " -ShowProfile(\"{$login}\");"; +ShowProfile({$login});"; } return $scriptText; } diff --git a/application/core/Libs/FML/Script/Features/ScriptFeature.php b/application/core/Libs/FML/Script/Features/ScriptFeature.php index bab2efea..bf0f33e8 100644 --- a/application/core/Libs/FML/Script/Features/ScriptFeature.php +++ b/application/core/Libs/FML/Script/Features/ScriptFeature.php @@ -13,15 +13,13 @@ use FML\Types\ScriptFeatureable; * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ abstract class ScriptFeature { - /** - * Collect the Script Features of the given Objects + * Collect the Script Features of the given objects * - * @param object $scriptFeatureable ScriptFeatureable Object - * @param object $_ (optional) Various Amount of additional Objects - * @return array + * @param ScriptFeatureable $objects (optional) Various amount of ScriptFeatureable objects + * @return ScriptFeature[] */ - public static function collect($scriptFeatureable, $_ = null) { + public static function collect() { $params = func_get_args(); $scriptFeatures = array(); foreach ($params as $object) { @@ -35,10 +33,10 @@ abstract class ScriptFeature { } /** - * Prepare the given Script for Rendering by adding the needed Labels, etc. + * Prepare the given Script for rendering by adding the needed Labels, etc. * * @param Script $script Script to prepare - * @return \FML\Script\Features\ScriptFeature + * @return \FML\Script\Features\ScriptFeature|static */ public abstract function prepare(Script $script); } diff --git a/application/core/Libs/FML/Script/Features/Toggle.php b/application/core/Libs/FML/Script/Features/Toggle.php index d707c999..5c4eb662 100644 --- a/application/core/Libs/FML/Script/Features/Toggle.php +++ b/application/core/Libs/FML/Script/Features/Toggle.php @@ -16,7 +16,7 @@ use FML\Types\Scriptable; */ class Toggle extends ScriptFeature { /* - * Protected Properties + * Protected properties */ /** @var Control $togglingControl */ protected $togglingControl = null; @@ -31,23 +31,28 @@ class Toggle extends ScriptFeature { * * @param Control $togglingControl (optional) Toggling Control * @param Control $toggledControl (optional) Toggled Control - * @param string $labelName (optional) Script Label Name - * @param bool $onlyShow (optional) Whether it should only Show the Control but not toggle - * @param bool $onlyHide (optional) Whether it should only Hide the Control but not toggle + * @param string $labelName (optional) Script Label name + * @param bool $onlyShow (optional) Whether it should only show the Control but not toggle + * @param bool $onlyHide (optional) Whether it should only hide the Control but not toggle */ - public function __construct(Control $togglingControl = null, Control $toggledControl = null, $labelName = ScriptLabel::MOUSECLICK, $onlyShow = false, $onlyHide = false) { - $this->setTogglingControl($togglingControl); - $this->setToggledControl($toggledControl); + public function __construct(Control $togglingControl = null, Control $toggledControl = null, $labelName = ScriptLabel::MOUSECLICK, + $onlyShow = false, $onlyHide = false) { + if (!is_null($togglingControl)) { + $this->setTogglingControl($togglingControl); + } + if (!is_null($toggledControl)) { + $this->setToggledControl($toggledControl); + } $this->setLabelName($labelName); $this->setOnlyShow($onlyShow); $this->setOnlyHide($onlyHide); } /** - * Set the Toggling Control + * Set the toggling Control * * @param Control $control Toggling Control - * @return \FML\Script\Features\Toggle + * @return \FML\Script\Features\Toggle|static */ public function setTogglingControl(Control $control) { $control->checkId(); @@ -59,22 +64,21 @@ class Toggle extends ScriptFeature { } /** - * Set the Toggled Control + * Set the toggled Control * * @param Control $control Toggling Control - * @return \FML\Script\Features\Toggle + * @return \FML\Script\Features\Toggle|static */ public function setToggledControl(Control $control) { - $control->checkId(); - $this->toggledControl = $control; + $this->toggledControl = $control->checkId(); return $this; } /** - * Set the Label Name + * Set the label name * * @param string $labelName Script Label Name - * @return \FML\Script\Features\Toggle + * @return \FML\Script\Features\Toggle|static */ public function setLabelName($labelName) { $this->labelName = (string)$labelName; @@ -82,10 +86,10 @@ class Toggle extends ScriptFeature { } /** - * Set only Show + * Set to only show * - * @param bool $onlyShow Whether it should only Show the Control but not toggle - * @return \FML\Script\Features\Toggle + * @param bool $onlyShow Whether it should only show the Control but not toggle + * @return \FML\Script\Features\Toggle|static */ public function setOnlyShow($onlyShow) { $this->onlyShow = (bool)$onlyShow; @@ -93,10 +97,10 @@ class Toggle extends ScriptFeature { } /** - * Set only Hide + * Set to only hide * - * @param bool $onlyHide Whether it should only Hide the Control but not toggle - * @return \FML\Script\Features\Toggle + * @param bool $onlyHide Whether it should only hide the Control but not toggle + * @return \FML\Script\Features\Toggle|static */ public function setOnlyHide($onlyHide) { $this->onlyHide = (bool)$onlyHide; @@ -112,24 +116,23 @@ class Toggle extends ScriptFeature { } /** - * Get the Script Text + * Get the script text * * @return string */ protected function getScriptText() { - $togglingControlId = $this->togglingControl->getId(true); - $toggledControlId = $this->toggledControl->getId(true); + $togglingControlId = $this->togglingControl->getId(true, true); + $toggledControlId = $this->toggledControl->getId(true, true); $visibility = '!ToggleControl.Visible'; if ($this->onlyShow) { $visibility = 'True'; } else if ($this->onlyHide) { $visibility = 'False'; } - $scriptText = " -if (Event.Control.ControlId == \"{$togglingControlId}\") { - declare ToggleControl = Page.GetFirstChild(\"{$toggledControlId}\"); + return " +if (Event.Control.ControlId == {$togglingControlId}) { + declare ToggleControl = Page.GetFirstChild({$toggledControlId}); ToggleControl.Visible = {$visibility}; }"; - return $scriptText; } } diff --git a/application/core/Libs/FML/Script/Features/Tooltip.php b/application/core/Libs/FML/Script/Features/Tooltip.php index 67f27248..083fccdd 100644 --- a/application/core/Libs/FML/Script/Features/Tooltip.php +++ b/application/core/Libs/FML/Script/Features/Tooltip.php @@ -10,7 +10,7 @@ use FML\Script\ScriptLabel; use FML\Types\Scriptable; /** - * Script Feature for Showing Tooltips + * Script Feature for showing Tooltips * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -18,7 +18,7 @@ use FML\Types\Scriptable; */ class Tooltip extends ScriptFeature { /* - * Protected Properties + * Protected properties */ /** @var Control $hoverControl */ protected $hoverControl = null; @@ -33,23 +33,29 @@ class Tooltip extends ScriptFeature { * * @param Control $hoverControl (optional) Hover Control * @param Control $tooltipControl (optional) Tooltip Control - * @param bool $stayOnClick (optional) Whether the Tooltip should stay on Click - * @param bool $invert (optional) Whether the Visibility Toggling should be inverted - * @param string $text (optional) The Text to display if the TooltipControl is a Label + * @param bool $stayOnClick (optional) Whether the Tooltip should stay on click + * @param bool $invert (optional) Whether the visibility toggling should be inverted + * @param string $text (optional) Text to display if the TooltipControl is a Label */ public function __construct(Control $hoverControl = null, Control $tooltipControl = null, $stayOnClick = false, $invert = false, $text = null) { - $this->setHoverControl($hoverControl); - $this->setTooltipControl($tooltipControl); + if (!is_null($hoverControl)) { + $this->setHoverControl($hoverControl); + } + if (!is_null($tooltipControl)) { + $this->setTooltipControl($tooltipControl); + } $this->setStayOnClick($stayOnClick); $this->setInvert($invert); - $this->setText($text); + if (!is_null($text)) { + $this->setText($text); + } } /** * Set the Hover Control * * @param Control $hoverControl Hover Control - * @return \FML\Script\Features\Tooltip + * @return \FML\Script\Features\Tooltip|static */ public function setHoverControl(Control $hoverControl) { $hoverControl->checkId(); @@ -64,20 +70,18 @@ class Tooltip extends ScriptFeature { * Set the Tooltip Control * * @param Control $tooltipControl Tooltip Control - * @return \FML\Script\Features\Tooltip + * @return \FML\Script\Features\Tooltip|static */ public function setTooltipControl(Control $tooltipControl) { - $tooltipControl->checkId(); - $tooltipControl->setVisible(false); - $this->tooltipControl = $tooltipControl; + $this->tooltipControl = $tooltipControl->checkId()->setVisible(false); return $this; } /** - * Set only Show + * Set to only show * - * @param bool $stayOnClick (optional) Whether the Tooltip should stay on Click - * @return \FML\Script\Features\Tooltip + * @param bool $stayOnClick (optional) Whether the Tooltip should stay on click + * @return \FML\Script\Features\Tooltip|static */ public function setStayOnClick($stayOnClick) { $this->stayOnClick = (bool)$stayOnClick; @@ -85,10 +89,10 @@ class Tooltip extends ScriptFeature { } /** - * Set only Hide + * Set to only hide * - * @param bool $invert (optional) Whether the Visibility Toggling should be inverted - * @return \FML\Script\Features\Tooltip + * @param bool $invert (optional) Whether the visibility toggling should be inverted + * @return \FML\Script\Features\Tooltip|static */ public function setInvert($invert) { $this->invert = (bool)$invert; @@ -96,13 +100,13 @@ class Tooltip extends ScriptFeature { } /** - * Set Text + * Set text * - * @param string $text (optional) The Text to display if the TooltipControl is a Label - * @return \FML\Script\Features\Tooltip + * @param string $text (optional) Text to display if the TooltipControl is a Label + * @return \FML\Script\Features\Tooltip|static */ public function setText($text) { - $this->text = $text; + $this->text = (string)$text; return $this; } @@ -110,20 +114,20 @@ class Tooltip extends ScriptFeature { * @see \FML\Script\Features\ScriptFeature::prepare() */ public function prepare(Script $script) { - $hoverControlId = $this->hoverControl->getId(true); - $tooltipControlId = $this->tooltipControl->getId(true); + $hoverControlId = $this->hoverControl->getId(true, true); + $tooltipControlId = $this->tooltipControl->getId(true, true); // MouseOver $visibility = ($this->invert ? 'False' : 'True'); $scriptText = " -if (Event.Control.ControlId == \"{$hoverControlId}\") { - declare TooltipControl = Page.GetFirstChild(\"{$tooltipControlId}\"); +if (Event.Control.ControlId == {$hoverControlId}) { + declare TooltipControl = Page.GetFirstChild({$tooltipControlId}); TooltipControl.Visible = {$visibility};"; if (is_string($this->text) && ($this->tooltipControl instanceof Label)) { - $tooltipText = Builder::escapeText($this->text); + $tooltipText = Builder::escapeText($this->text, true); $scriptText .= " declare TooltipLabel = (TooltipControl as CMlLabel); - TooltipLabel.Value = \"{$tooltipText}\";"; + TooltipLabel.Value = {$tooltipText};"; } $scriptText .= " }"; @@ -132,8 +136,8 @@ if (Event.Control.ControlId == \"{$hoverControlId}\") { // MouseOut $visibility = ($this->invert ? 'True' : 'False'); $scriptText = " -if (Event.Control.ControlId == \"{$hoverControlId}\") { - declare TooltipControl = Page.GetFirstChild(\"{$tooltipControlId}\");"; +if (Event.Control.ControlId == {$hoverControlId}) { + declare TooltipControl = Page.GetFirstChild({$tooltipControlId});"; if ($this->stayOnClick) { $scriptText .= " declare FML_Clicked for Event.Control = False; @@ -147,7 +151,7 @@ if (Event.Control.ControlId == \"{$hoverControlId}\") { // MouseClick if ($this->stayOnClick) { $scriptText = " -if (Event.Control.ControlId == \"{$hoverControlId}\") { +if (Event.Control.ControlId == {$hoverControlId}) { declare FML_Clicked for Event.Control = False; FML_Clicked = !FML_Clicked; }"; diff --git a/application/core/Libs/FML/Script/Features/UISound.php b/application/core/Libs/FML/Script/Features/UISound.php index 76a93575..0cf1aee4 100644 --- a/application/core/Libs/FML/Script/Features/UISound.php +++ b/application/core/Libs/FML/Script/Features/UISound.php @@ -9,7 +9,7 @@ use FML\Script\ScriptLabel; use FML\Types\Scriptable; /** - * Script Feature for playing an UI Sound + * Script Feature for playing a UISound * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -50,7 +50,7 @@ class UISound extends ScriptFeature { const Warning = 'Warning'; /* - * Protected Properties + * Protected properties */ protected $soundName = null; /** @var Control $control */ @@ -62,23 +62,27 @@ class UISound extends ScriptFeature { /** * Construct a new UISound Feature * - * @param string $soundName (optional) Played Sound + * @param string $soundName (optional) Played sound * @param Control $control (optional) Action Control - * @param int $variant (optional) Sound Variant - * @param string $labelName (optional) Script Label Name + * @param int $variant (optional) Sound variant + * @param string $labelName (optional) Script Label name */ public function __construct($soundName = null, Control $control = null, $variant = 0, $labelName = ScriptLabel::MOUSECLICK) { - $this->setSoundName($soundName); - $this->setControl($control); + if (!is_null($soundName)) { + $this->setSoundName($soundName); + } + if (!is_null($control)) { + $this->setControl($control); + } $this->setVariant($variant); $this->setLabelName($labelName); } /** - * Set the Sound to play + * Set the sound to play * - * @param string $soundName Sound Name - * @return \FML\Script\Features\UISound + * @param string $soundName Sound name + * @return \FML\Script\Features\UISound|static */ public function setSoundName($soundName) { $this->soundName = (string)$soundName; @@ -89,7 +93,7 @@ class UISound extends ScriptFeature { * Set the Control * * @param Control $control Action Control - * @return \FML\Script\Features\UISound + * @return \FML\Script\Features\UISound|static */ public function setControl(Control $control) { $control->checkId(); @@ -101,10 +105,10 @@ class UISound extends ScriptFeature { } /** - * Set the Sound Variant + * Set the sound variant * - * @param int $variant Sound Variant - * @return \FML\Script\Features\UISound + * @param int $variant Sound variant + * @return \FML\Script\Features\UISound|static */ public function setVariant($variant) { $this->variant = (int)$variant; @@ -112,10 +116,10 @@ class UISound extends ScriptFeature { } /** - * Set the Volume + * Set the volume * - * @param float $volume Sound Volume - * @return \FML\Script\Features\UISound + * @param float $volume Sound volume + * @return \FML\Script\Features\UISound|static */ public function setVolume($volume) { $this->volume = (float)$volume; @@ -123,10 +127,10 @@ class UISound extends ScriptFeature { } /** - * Set the Label Name + * Set the label name * - * @param string $labelName Script Label Name - * @return \FML\Script\Features\UISound + * @param string $labelName Script Label name + * @return \FML\Script\Features\UISound|static */ public function setLabelName($labelName) { $this->labelName = (string)$labelName; @@ -142,16 +146,16 @@ class UISound extends ScriptFeature { } /** - * Get the Script Text + * Get the script text * * @return string */ protected function getScriptText() { if ($this->control) { // Control event - $controlId = Builder::escapeText($this->control->getId()); + $controlId = Builder::escapeText($this->control->getId(), true); $scriptText = " -if (Event.Control.ControlId == \"{$controlId}\") { +if (Event.Control.ControlId == {$controlId}) { PlayUiSound(CMlScriptIngame::EUISound::{$this->soundName}, {$this->variant}, {$this->volume}); }"; } else { diff --git a/application/core/Libs/FML/Script/Features/ValuePickerFeature.php b/application/core/Libs/FML/Script/Features/ValuePickerFeature.php index 951056c9..4fb2f2ec 100644 --- a/application/core/Libs/FML/Script/Features/ValuePickerFeature.php +++ b/application/core/Libs/FML/Script/Features/ValuePickerFeature.php @@ -10,7 +10,7 @@ use FML\Script\ScriptInclude; use FML\Script\ScriptLabel; /** - * Script Feature for creating a ValuePicker Behavior + * Script Feature for creating a ValuePicker behavior * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -26,13 +26,13 @@ class ValuePickerFeature extends ScriptFeature { const VAR_PICKER_ENTRY_ID = 'FML_Picker_EntryId'; /* - * Protected Properties + * Protected properties */ /** @var Label $label */ protected $label = null; /** @var Entry $entry */ protected $entry = null; - protected $values = null; + protected $values = array(); protected $default = null; /** @@ -40,28 +40,32 @@ class ValuePickerFeature extends ScriptFeature { * * @param Label $label (optional) ValuePicker Label * @param Entry $entry (optional) Hidden Entry - * @param array $values (optional) Possible Values - * @param string $default (optional) Default Value + * @param array $values (optional) Possible values + * @param string $default (optional) Default value */ public function __construct(Label $label = null, Entry $entry = null, array $values = array(), $default = null) { - $this->setLabel($label); - $this->setEntry($entry); - $this->setValues($values); - $this->setDefault($default); + if (!is_null($label)) { + $this->setLabel($label); + } + if (!is_null($entry)) { + $this->setEntry($entry); + } + if (!empty($values)) { + $this->setValues($values); + } + if (!is_null($default)) { + $this->setDefault($default); + } } /** * Set the ValuePicker Label * * @param Label $label ValuePicker Label - * @return \FML\Script\Features\ValuePickerFeature + * @return \FML\Script\Features\ValuePickerFeature|static */ - public function setLabel(Label $label = null) { - if ($label) { - $label->checkId(); - $label->setScriptEvents(true); - } - $this->label = $label; + public function setLabel(Label $label) { + $this->label = $label->checkId()->setScriptEvents(true); return $this; } @@ -78,13 +82,10 @@ class ValuePickerFeature extends ScriptFeature { * Set the hidden Entry * * @param Entry $entry Hidden Entry - * @return \FML\Script\Features\ValuePickerFeature + * @return \FML\Script\Features\ValuePickerFeature|static */ - public function setEntry(Entry $entry = null) { - if ($entry) { - $entry->checkId(); - } - $this->entry = $entry; + public function setEntry(Entry $entry) { + $this->entry = $entry->checkId(); return $this; } @@ -98,10 +99,10 @@ class ValuePickerFeature extends ScriptFeature { } /** - * Set the possible Values + * Set the possible values * - * @param array $values Possible Values - * @return \FML\Script\Features\ValuePickerFeature + * @param array $values Possible values + * @return \FML\Script\Features\ValuePickerFeature|static */ public function setValues(array $values) { $this->values = array(); @@ -112,17 +113,17 @@ class ValuePickerFeature extends ScriptFeature { } /** - * Set the default Value + * Set the default value * - * @param string $default Default Value - * @return \FML\Script\Features\ValuePickerFeature + * @param string $default Default value + * @return \FML\Script\Features\ValuePickerFeature|static */ public function setDefault($default) { $this->default = (string)$default; } /** - * Get the default Value + * Get the default value * * @return string */ @@ -130,7 +131,7 @@ class ValuePickerFeature extends ScriptFeature { if ($this->default) { return $this->default; } - if ($this->values) { + if (!empty($this->values)) { return reset($this->values); } return null; @@ -150,12 +151,12 @@ class ValuePickerFeature extends ScriptFeature { } /** - * Build the Function Text + * Build the function text * * @return string */ protected function buildUpdatePickerValueFunction() { - $functionText = " + return " Void " . self::FUNCTION_UPDATE_PICKER_VALUE . "(CMlLabel _Label) { declare " . self::VAR_PICKER_VALUES . " as Values for _Label = Text[]; declare NewValueIndex = -1; @@ -168,61 +169,58 @@ Void " . self::FUNCTION_UPDATE_PICKER_VALUE . "(CMlLabel _Label) { NewValueIndex = 0; } } - declare NewValue = \"\"; + declare NewValue = " . Builder::EMPTY_STRING . "; if (Values.existskey(NewValueIndex)) { NewValue = Values[NewValueIndex]; } else { - declare " . self::VAR_PICKER_DEFAULT_VALUE . " as Default for _Label = \"\"; + declare " . self::VAR_PICKER_DEFAULT_VALUE . " as Default for _Label = " . Builder::EMPTY_STRING . "; NewValue = Default; } _Label.Value = NewValue; - declare " . self::VAR_PICKER_ENTRY_ID . " as EntryId for _Label = \"\"; - if (EntryId != \"\") { + declare " . self::VAR_PICKER_ENTRY_ID . " as EntryId for _Label = " . Builder::EMPTY_STRING . "; + if (EntryId != " . Builder::EMPTY_STRING . ") { declare Entry <=> (Page.GetFirstChild(EntryId) as CMlEntry); Entry.Value = NewValue; } }"; - return $functionText; } /** - * Build the Init Script Text + * Build the init script text * * @return string */ protected function buildInitScriptText() { - $labelId = $this->label->getId(true); - $entryId = ''; + $labelId = $this->label->getId(true, true); + $entryId = '""'; if ($this->entry) { - $entryId = $this->entry->getId(true); + $entryId = $this->entry->getId(true, true); } - $values = Builder::getArray($this->values); - $default = $this->getDefault(); - $scriptText = " -declare Label_Picker <=> (Page.GetFirstChild(\"{$labelId}\") as CMlLabel); + $values = Builder::getArray($this->values); + $default = Builder::escapeText($this->getDefault(), true); + return " +declare Label_Picker <=> (Page.GetFirstChild({$labelId}) as CMlLabel); declare Text[] " . self::VAR_PICKER_VALUES . " as Values for Label_Picker; Values = {$values}; declare Text " . self::VAR_PICKER_DEFAULT_VALUE . " as Default for Label_Picker; -Default = \"{$default}\"; +Default = {$default}; declare Text " . self::VAR_PICKER_ENTRY_ID . " as EntryId for Label_Picker; -EntryId = \"{$entryId}\"; +EntryId = {$entryId}; " . self::FUNCTION_UPDATE_PICKER_VALUE . "(Label_Picker); "; - return $scriptText; } /** - * Build the Script Text for Label Clicks + * Build the script text for Label clicks * * @return string */ protected function buildClickScriptText() { - $labelId = $this->label->getId(true); - $scriptText = " -if (Event.ControlId == \"{$labelId}\") { + $labelId = $this->label->getId(true, true); + return " +if (Event.ControlId == {$labelId}) { declare Label_Picker <=> (Event.Control as CMlLabel); " . self::FUNCTION_UPDATE_PICKER_VALUE . "(Label_Picker); }"; - return $scriptText; } } diff --git a/application/core/Libs/FML/Script/Script.php b/application/core/Libs/FML/Script/Script.php index 273cbb2c..ce4f7419 100644 --- a/application/core/Libs/FML/Script/Script.php +++ b/application/core/Libs/FML/Script/Script.php @@ -21,7 +21,7 @@ class Script { const VAR_LastTick = 'FML_LastTick'; /* - * Protected Properties + * Protected properties */ protected $tagName = 'script'; protected $features = array(); @@ -34,9 +34,9 @@ class Script { /** * Set a Script Include * - * @param string $file Include File - * @param string $namespace Include Namespace - * @return \FML\Script\Script + * @param string $file Include file + * @param string $namespace Include namespace + * @return \FML\Script\Script|static */ public function setScriptInclude($file, $namespace = null) { if (is_object($file) && ($file instanceof ScriptInclude)) { @@ -44,17 +44,16 @@ class Script { } else { $scriptInclude = new ScriptInclude($file, $namespace); } - $namespace = $scriptInclude->getNamespace(); - $this->includes[$namespace] = $scriptInclude; + $this->includes[$scriptInclude->getNamespace()] = $scriptInclude; return $this; } /** * Add a Script Constant * - * @param string $name Constant Name - * @param string $value Constant Value - * @return \FML\Script\Script + * @param string $name Constant name + * @param string $value Constant value + * @return \FML\Script\Script|static */ public function addScriptConstant($name, $value = null) { if (is_object($name) && ($name instanceof ScriptConstant)) { @@ -62,16 +61,18 @@ class Script { } else { $scriptConstant = new ScriptConstant($name, $value); } - array_push($this->constants, $scriptConstant); + if (!in_array($scriptConstant, $this->constants)) { + array_push($this->constants, $scriptConstant); + } return $this; } /** * Add a Script Function * - * @param string $name Function Name - * @param string $text Function Text - * @return \FML\Script\Script + * @param string $name Function name + * @param string $text Function text + * @return \FML\Script\Script|static */ public function addScriptFunction($name, $text = null) { if (is_object($name) && ($name instanceof ScriptFunction)) { @@ -86,11 +87,11 @@ class Script { } /** - * Add a custom Script Text + * Add a custom Script text * - * @param string $name Label Name - * @param string $text Script Text - * @return \FML\Script\Script + * @param string $name Label name + * @param string $text Script text + * @return \FML\Script\Script|static */ public function addCustomScriptLabel($name, $text = null) { if (is_object($name) && ($name instanceof ScriptLabel)) { @@ -103,12 +104,12 @@ class Script { } /** - * Append a generic Script Text for the next Rendering + * Append a generic Script text for the next rendering * - * @param string $name Label Name - * @param string $text Script Text + * @param string $name Label name + * @param string $text Script text * @param bool $isolated (optional) Whether to isolate the Label Script - * @return \FML\Script\Script + * @return \FML\Script\Script|static */ public function appendGenericScriptLabel($name, $text = null, $isolated = false) { if (is_object($name) && ($name instanceof ScriptLabel)) { @@ -121,9 +122,9 @@ class Script { } /** - * Remove all generic Script Texts + * Remove all generic Script texts * - * @return \FML\Script\Script + * @return \FML\Script\Script|static */ public function resetGenericScriptLabels() { $this->genericLabels = array(); @@ -131,13 +132,15 @@ class Script { } /** - * Add an own Script Feature + * Add a Script Feature * * @param ScriptFeature $feature Script Feature - * @return \FML\Script\Script + * @return \FML\Script\Script|static */ public function addFeature(ScriptFeature $feature) { - array_push($this->features, $feature); + if (!in_array($feature, $this->features, true)) { + array_push($this->features, $feature); + } return $this; } @@ -145,7 +148,7 @@ class Script { * Load the given Script Feature * * @param ScriptFeature $scriptFeature Script Feature to load - * @return \FML\Script\Script + * @return \FML\Script\Script|static */ public function loadFeature(ScriptFeature $scriptFeature) { $scriptFeature->prepare($this); @@ -155,8 +158,8 @@ class Script { /** * Load the given Script Features * - * @param array $scriptFeatures Script Features to load - * @return \FML\Script\Script + * @param ScriptFeature[] $scriptFeatures Script Features to load + * @return \FML\Script\Script|static */ public function loadFeatures(array $scriptFeatures) { foreach ($scriptFeatures as $scriptFeature) { @@ -166,7 +169,7 @@ class Script { } /** - * Check if the Script has Stuff so that it needs to be rendered + * Check if the Script has content so that it needs to be rendered * * @return bool */ @@ -178,7 +181,7 @@ class Script { } /** - * Build the complete Script Text + * Build the complete Script text * * @return string */ @@ -194,9 +197,9 @@ class Script { } /** - * Create the Script XML Tag + * Build the Script XML element * - * @param \DOMDocument $domDocument DOMDocument for which the XML Element should be created + * @param \DOMDocument $domDocument DOMDocument for which the XML element should be created * @return \DOMElement */ public function render(\DOMDocument $domDocument) { @@ -209,7 +212,7 @@ class Script { } /** - * Get the Header Comment + * Get the header comment * * @return string */ @@ -224,7 +227,7 @@ class Script { } /** - * Get the Includes + * Get the Includes text * * @return string */ @@ -234,7 +237,7 @@ class Script { } /** - * Get the Constants + * Get the Constants text * * @return string */ @@ -244,7 +247,7 @@ class Script { } /** - * Get the Functions + * Get the Functions text * * @return string */ @@ -254,7 +257,7 @@ class Script { } /** - * Get the Labels + * Get the Labels text * * @return string */ @@ -265,7 +268,7 @@ class Script { } /** - * Get the Main Function + * Get the main function text * * @return string */ diff --git a/application/core/Libs/FML/Script/ScriptConstant.php b/application/core/Libs/FML/Script/ScriptConstant.php index d94316aa..e0c94b8e 100644 --- a/application/core/Libs/FML/Script/ScriptConstant.php +++ b/application/core/Libs/FML/Script/ScriptConstant.php @@ -11,7 +11,7 @@ namespace FML\Script; */ class ScriptConstant { /* - * Protected Properties + * Protected properties */ protected $name = null; protected $value = null; @@ -19,8 +19,8 @@ class ScriptConstant { /** * Construct a new Script Constant * - * @param string $name (optional) Constant Name - * @param string $value (optional) Constant Value + * @param string $name (optional) Constant name + * @param string $value (optional) Constant value */ public function __construct($name = null, $value = null) { $this->setName($name); @@ -28,21 +28,21 @@ class ScriptConstant { } /** - * Set the Name + * Set the name * - * @param string $name Constant Name - * @return \FML\Script\ScriptConstant + * @param string $name Constant name + * @return \FML\Script\ScriptConstant|static */ public function setName($name) { - $this->name = $name; + $this->name = (string)$name; return $this; } /** - * Set the Value + * Set the value * - * @param string $value Constant Value - * @return \FML\Script\ScriptConstant + * @param string $value Constant value + * @return \FML\Script\ScriptConstant|static */ public function setValue($value) { $this->value = $value; @@ -50,12 +50,11 @@ class ScriptConstant { } /** - * Build the Script Constant Text + * Build the Script Constant text * * @return string */ public function __toString() { - $scriptText = Builder::getConstant($this->name, $this->value); - return $scriptText; + return Builder::getConstant($this->name, $this->value); } } diff --git a/application/core/Libs/FML/Script/ScriptFunction.php b/application/core/Libs/FML/Script/ScriptFunction.php index 008246dc..ca06853f 100644 --- a/application/core/Libs/FML/Script/ScriptFunction.php +++ b/application/core/Libs/FML/Script/ScriptFunction.php @@ -11,7 +11,7 @@ namespace FML\Script; */ class ScriptFunction { /* - * Protected Properties + * Protected properties */ protected $name = null; protected $text = null; @@ -19,8 +19,8 @@ class ScriptFunction { /** * Construct a new Script Function * - * @param string $name (optional) Function Name - * @param string $text (optional) Function Text + * @param string $name (optional) Function name + * @param string $text (optional) Function text */ public function __construct($name = null, $text = null) { $this->setName($name); @@ -28,10 +28,10 @@ class ScriptFunction { } /** - * Set the Name + * Set the name * - * @param string $name Function Name - * @return \FML\Script\ScriptFunction + * @param string $name Function name + * @return \FML\Script\ScriptFunction|static */ public function setName($name) { $this->name = (string)$name; @@ -39,10 +39,10 @@ class ScriptFunction { } /** - * Set the Text + * Set the text * - * @param string $text Function Text - * @return \FML\Script\ScriptFunction + * @param string $text Function text + * @return \FML\Script\ScriptFunction|static */ public function setText($text) { $this->text = (string)$text; @@ -50,7 +50,7 @@ class ScriptFunction { } /** - * Get the Script Function Text + * Get the Script Function text * * @return string */ diff --git a/application/core/Libs/FML/Script/ScriptInclude.php b/application/core/Libs/FML/Script/ScriptInclude.php index e828abac..097a769c 100644 --- a/application/core/Libs/FML/Script/ScriptInclude.php +++ b/application/core/Libs/FML/Script/ScriptInclude.php @@ -17,7 +17,7 @@ class ScriptInclude { const TEXTLIB = 'TextLib'; /* - * Protected Properties + * Protected properties */ protected $file = null; protected $namespace = null; @@ -25,8 +25,8 @@ class ScriptInclude { /** * Construct a new Script Include * - * @param string $file (optional) Include File - * @param string $namespace (optional) Include Namespace + * @param string $file (optional) Include file + * @param string $namespace (optional) Include namespace */ public function __construct($file = null, $namespace = null) { $this->setFile($file); @@ -34,10 +34,10 @@ class ScriptInclude { } /** - * Set the File + * Set the file * - * @param string $file Include File - * @return \FML\Script\ScriptInclude + * @param string $file Include file + * @return \FML\Script\ScriptInclude|static */ public function setFile($file) { $this->file = (string)$file; @@ -45,10 +45,10 @@ class ScriptInclude { } /** - * Set the Namespace + * Set the namespace * - * @param string $namespace Include Namespace - * @return \FML\Script\ScriptInclude + * @param string $namespace Include namespace + * @return \FML\Script\ScriptInclude|static */ public function setNamespace($namespace) { $this->namespace = (string)$namespace; @@ -56,7 +56,7 @@ class ScriptInclude { } /** - * Get the Namespace + * Get the namespace * * @return string */ @@ -65,12 +65,11 @@ class ScriptInclude { } /** - * Build the Script Include Text + * Build the Script Include text * * @return string */ public function __toString() { - $scriptText = Builder::getInclude($this->file, $this->namespace); - return $scriptText; + return Builder::getInclude($this->file, $this->namespace); } } diff --git a/application/core/Libs/FML/Script/ScriptLabel.php b/application/core/Libs/FML/Script/ScriptLabel.php index 230f28cf..f224912f 100644 --- a/application/core/Libs/FML/Script/ScriptLabel.php +++ b/application/core/Libs/FML/Script/ScriptLabel.php @@ -3,7 +3,7 @@ namespace FML\Script; /** - * Class representing a Part of the ManiaLink Script + * Class representing a part of the ManiaLink Script * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -23,7 +23,7 @@ class ScriptLabel { const MOUSEOVER = 'FML_MouseOver'; /* - * Protected Properties + * Protected properties */ protected $name = null; protected $text = null; @@ -32,21 +32,21 @@ class ScriptLabel { /** * Construct a new ScriptLabel * - * @param string $name (optional) Label Name - * @param string $text (optional) Script Text + * @param string $name (optional) Label name + * @param string $text (optional) Script text * @param bool $isolated (optional) Isolate the Label Script */ - public function __construct($name = self::LOOP, $text = '', $isolated = false) { + public function __construct($name = self::LOOP, $text = null, $isolated = false) { $this->setName($name); $this->setText($text); $this->setIsolated($isolated); } /** - * Set the Name + * Set the name * - * @param string $name Label Name - * @return \FML\Script\ScriptLabel + * @param string $name Label name + * @return \FML\Script\ScriptLabel|static */ public function setName($name) { $this->name = (string)$name; @@ -54,10 +54,10 @@ class ScriptLabel { } /** - * Set the Text + * Set the text * - * @param string $text Script Text - * @return \FML\Script\ScriptLabel + * @param string $text Script text + * @return \FML\Script\ScriptLabel|static */ public function setText($text) { $this->text = (string)$text; @@ -65,10 +65,10 @@ class ScriptLabel { } /** - * Set Isolation + * Set isolation * - * @param bool $isolated Whether the Code should be isolated in an own Block - * @return \FML\Script\ScriptLabel + * @param bool $isolated Whether the code should be isolated in an own block + * @return \FML\Script\ScriptLabel|static */ public function setIsolated($isolated) { $this->isolated = (bool)$isolated; @@ -76,35 +76,33 @@ class ScriptLabel { } /** - * Check if the given Label is an Event Label + * Check if the given label is an event label * - * @param string $label Label Name + * @param string $label Label name * @return bool */ public static function isEventLabel($label) { - $eventLabels = self::getEventLabels(); - if (in_array($label, $eventLabels)) { + if (in_array($label, static::getEventLabels())) { return true; } return false; } /** - * Get the possible Event Label Names + * Get the possible event label names * - * @return array + * @return string[] */ public static function getEventLabels() { return array(self::ENTRYSUBMIT, self::KEYPRESS, self::MOUSECLICK, self::MOUSEOUT, self::MOUSEOVER); } /** - * Build the full Script Label Text + * Build the full Script Label text * * @return string */ public function __toString() { - $scriptText = Builder::getLabelImplementationBlock($this->name, $this->text, $this->isolated); - return $scriptText; + return Builder::getLabelImplementationBlock($this->name, $this->text, $this->isolated); } } diff --git a/application/core/Libs/FML/Stylesheet/Mood.php b/application/core/Libs/FML/Stylesheet/Mood.php index c7bf6f7c..6cac4315 100644 --- a/application/core/Libs/FML/Stylesheet/Mood.php +++ b/application/core/Libs/FML/Stylesheet/Mood.php @@ -6,7 +6,7 @@ namespace FML\Stylesheet; // Missing attributes: LDir1.. /** - * Class representing a Stylesheets Mood + * Class representing a Stylesheet Mood * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -14,109 +14,90 @@ namespace FML\Stylesheet; */ class Mood { /* - * Protected Properties + * Protected properties */ protected $tagName = 'mood'; - protected $lAmbient_LinearRgb = ''; - protected $cloudsRgbMinLinear = ''; - protected $cloudsRgbMaxLinear = ''; - protected $lDir0_LinearRgb = ''; + protected $lAmbient_LinearRgb = null; + protected $cloudsRgbMinLinear = null; + protected $cloudsRgbMaxLinear = null; + protected $lDir0_LinearRgb = null; protected $lDir0_Intens = 1.; protected $lDir0_DirPhi = 0.; protected $lDir0_DirTheta = 0.; - protected $lBall_LinearRgb = ''; + protected $lBall_LinearRgb = null; protected $lBall_Intensity = 1.; protected $lBall_Radius = 0.; - protected $fogColorSrgb = ''; - protected $selfIllumColor = ''; + protected $fogColorSrgb = null; + protected $selfIllumColor = null; protected $skyGradientV_Scale = 1.; protected $skyGradientKeys = array(); /** - * Create a new Mood Object + * Create a new Mood object * - * @return \FML\Stylesheet\Mood + * @return \FML\Stylesheet\Mood|static */ public static function create() { - $mood = new Mood(); - return $mood; + return new static(); } /** - * Construct a new Mood Object - */ - public function __construct() { - } - - /** - * Set Ambient Color in which the Elements reflect the Light + * Set ambient color in which the Elements reflect the light * - * @param float $red Red Color Value - * @param float $green Green Color Value - * @param float $blue Blue Color Value - * @return \FML\Stylesheet\Mood + * @param float $red Red color value + * @param float $green Green color value + * @param float $blue Blue color value + * @return \FML\Stylesheet\Mood|static */ public function setLightAmbientColor($red, $green, $blue) { - $red = (float)$red; - $green = (float)$green; - $blue = (float)$blue; - $this->lAmbient_LinearRgb = "{$red} {$green} {$blue}"; + $this->lAmbient_LinearRgb = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue); return $this; } /** - * Set Minimum Value for the Background Color Range + * Set minimum value for the background color range * - * @param float $red Red Color Value - * @param float $green Green Color Value - * @param float $blue Blue Color Value - * @return \FML\Stylesheet\Mood + * @param float $red Red color value + * @param float $green Green color value + * @param float $blue Blue color value + * @return \FML\Stylesheet\Mood|static */ public function setCloudsColorMin($red, $green, $blue) { - $red = (float)$red; - $green = (float)$green; - $blue = (float)$blue; - $this->cloudsRgbMinLinear = "{$red} {$green} {$blue}"; + $this->cloudsRgbMinLinear = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue); return $this; } /** - * Set Maximum Value for the Background Color Range + * Set maximum value for the background color range * - * @param float $red Red Color Value - * @param float $green Green Color Value - * @param float $blue Blue Color Value - * @return \FML\Stylesheet\Mood + * @param float $red Red color value + * @param float $green Green color value + * @param float $blue Blue color value + * @return \FML\Stylesheet\Mood|static */ public function setCloudsColorMax($red, $green, $blue) { - $red = (float)$red; - $green = (float)$green; - $blue = (float)$blue; - $this->cloudsRgbMaxLinear = "{$red} {$green} {$blue}"; + $this->cloudsRgbMaxLinear = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue); return $this; } /** - * Set RGB Color of Light Source 0 + * Set RGB color of light source 0 * - * @param float $red Red Color Value - * @param float $green Green Color Value - * @param float $blue Blue Color Value - * @return \FML\Stylesheet\Mood + * @param float $red Red color value + * @param float $green Green color value + * @param float $blue Blue color value + * @return \FML\Stylesheet\Mood|static */ public function setLight0Color($red, $green, $blue) { - $red = (float)$red; - $green = (float)$green; - $blue = (float)$blue; - $this->lDir0_LinearRgb = "{$red} {$green} {$blue}"; + $this->lDir0_LinearRgb = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue); return $this; } /** - * Set Intensity of Light Source 0 + * Set intensity of light source 0 * - * @param float $intensity Light Intensity - * @return \FML\Stylesheet\Mood + * @param float $intensity Light intensity + * @return \FML\Stylesheet\Mood|static */ public function setLight0Intensity($intensity) { $this->lDir0_Intens = (float)$intensity; @@ -124,10 +105,10 @@ class Mood { } /** - * Set Phi-Angle of Light Source 0 + * Set phi angle of light source 0 * - * @param float $phiAngle Phi-Angle - * @return \FML\Stylesheet\Mood + * @param float $phiAngle Phi angle + * @return \FML\Stylesheet\Mood|static */ public function setLight0PhiAngle($phiAngle) { $this->lDir0_DirPhi = (float)$phiAngle; @@ -135,10 +116,10 @@ class Mood { } /** - * Set Theta-Angle of Light Source 0 + * Set theta angle of light source 0 * - * @param float $thetaAngle Theta-Angle - * @return \FML\Stylesheet\Mood + * @param float $thetaAngle Theta angle + * @return \FML\Stylesheet\Mood|static */ public function setLight0ThetaAngle($thetaAngle) { $this->lDir0_DirTheta = (float)$thetaAngle; @@ -146,26 +127,23 @@ class Mood { } /** - * Set Light Ball Color + * Set light ball color * - * @param float $red Red Color Value - * @param float $green Green Color Value - * @param float $blue Blue Color Value - * @return \FML\Stylesheet\Mood + * @param float $red Red color value + * @param float $green Green color value + * @param float $blue Blue color value + * @return \FML\Stylesheet\Mood|static */ public function setLightBallColor($red, $green, $blue) { - $red = (float)$red; - $green = (float)$green; - $blue = (float)$blue; - $this->lBall_LinearRgb = "{$red} {$green} {$blue}"; + $this->lBall_LinearRgb = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue); return $this; } /** - * Set Light Ball Intensity + * Set light ball intensity * - * @param float $intensity Light Ball Intensity - * @return \FML\Stylesheet\Mood + * @param float $intensity Light ball intensity + * @return \FML\Stylesheet\Mood|static */ public function setLightBallIntensity($intensity) { $this->lBall_Intensity = (float)$intensity; @@ -173,10 +151,10 @@ class Mood { } /** - * Set Light Ball Radius + * Set light ball radius * - * @param float $radius Light Ball Radius - * @return \FML\Stylesheet\Mood + * @param float $radius Light ball radius + * @return \FML\Stylesheet\Mood|static */ public function setLightBallRadius($radius) { $this->lBall_Radius = (float)$radius; @@ -184,42 +162,36 @@ class Mood { } /** - * Set Fog Color + * Set fog color * - * @param float $red Red Color Value - * @param float $green Green Color Value - * @param float $blue Blue Color Value - * @return \FML\Stylesheet\Mood + * @param float $red Red color value + * @param float $green Green color value + * @param float $blue Blue color value + * @return \FML\Stylesheet\Mood|static */ public function setFogColor($red, $green, $blue) { - $red = (float)$red; - $green = (float)$green; - $blue = (float)$blue; - $this->fogColorSrgb = "{$red} {$green} {$blue}"; + $this->fogColorSrgb = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue); return $this; } /** - * Set Self Illumination Color + * Set self illumination color * - * @param float $red Red Color Value - * @param float $green Green Color Value - * @param float $blue Blue Color Value - * @return \FML\Stylesheet\Mood + * @param float $red Red color value + * @param float $green Green color value + * @param float $blue Blue color value + * @return \FML\Stylesheet\Mood|static */ public function setSelfIllumColor($red, $green, $blue) { - $red = (float)$red; - $green = (float)$green; - $blue = (float)$blue; - $this->selfIllumColor = "{$red} {$green} {$blue}"; + $this->selfIllumColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue); return $this; } /** - * Set Sky Gradient Scale + * Set sky gradient scale * - * @param float $scale Gradient Scale - * @return \FML\Stylesheet\Mood + * @param float $scale Gradient scale + * @return \FML\Stylesheet\Mood|static */ public function setSkyGradientScale($scale) { $this->skyGradientV_Scale = (float)$scale; @@ -227,24 +199,24 @@ class Mood { } /** - * Add a Key for the SkyGradient + * Add a sky gradient key * - * @param float $x Scale Value - * @param string $color Gradient Color - * @return \FML\Stylesheet\Mood + * @param float $gradientX Scale value + * @param string $color Gradient color + * @return \FML\Stylesheet\Mood|static */ - public function addSkyGradientKey($x, $color) { - $x = (float)$x; + public function addSkyGradientKey($gradientX, $color) { + $gradientX = (float)$gradientX; $color = (string)$color; - $gradientKey = array('x' => $x, 'color' => $color); + $gradientKey = array('x' => $gradientX, 'color' => $color); array_push($this->skyGradientKeys, $gradientKey); return $this; } /** - * Remove all SkyGradient Keys + * Remove all sky gradient keys * - * @return \FML\Stylesheet\Mood + * @return \FML\Stylesheet\Mood|static */ public function removeSkyGradientKeys() { $this->skyGradientKeys = array(); @@ -252,9 +224,9 @@ class Mood { } /** - * Render the Mood XML Element + * Render the Mood XML element * - * @param \DOMDocument $domDocument DomDocument for which the Mood XML Element should be rendered + * @param \DOMDocument $domDocument DOMDocument for which the Mood XML element should be rendered * @return \DOMElement */ public function render(\DOMDocument $domDocument) { diff --git a/application/core/Libs/FML/Stylesheet/Style3d.php b/application/core/Libs/FML/Stylesheet/Style3d.php index 0c03e0e5..9ea8cf5e 100644 --- a/application/core/Libs/FML/Stylesheet/Style3d.php +++ b/application/core/Libs/FML/Stylesheet/Style3d.php @@ -2,8 +2,10 @@ namespace FML\Stylesheet; +use FML\UniqueID; + /** - * Class representing a specific Style3d + * Class representing a Style3d * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -20,10 +22,10 @@ class Style3d { const MODEL_Window = 'Window'; /* - * Protected Properties + * Protected properties */ protected $tagName = 'style3d'; - protected $id = null; + protected $styleId = null; protected $model = self::MODEL_Box; protected $thickness = null; protected $color = null; @@ -36,64 +38,63 @@ class Style3d { protected $focusZOffset = null; /** - * Create a new Style3d Object + * Create a new Style3d object * - * @param string $id (optional) Style Id - * @return \FML\Stylesheet\Style3d + * @param string $styleId (optional) Style id + * @return \FML\Stylesheet\Style3d|static */ - public static function create($id = null) { - $style3d = new Style3d($id); - return $style3d; + public static function create($styleId = null) { + return new static($styleId); } /** - * Construct a new Style3d Object + * Construct a new Style3d object * - * @param string $id (optional) Style Id + * @param string $styleId (optional) Style id */ - public function __construct($id = null) { - if ($id !== null) { - $this->setId($id); + public function __construct($styleId = null) { + if (!is_null($styleId)) { + $this->setId($styleId); } } /** - * Set Style Id + * Set style id * - * @param string $id Style Id - * @return \FML\Stylesheet\Style3d + * @param string $styleId Style id + * @return \FML\Stylesheet\Style3d|static */ - public function setId($id) { - $this->id = (string)$id; + public function setId($styleId) { + $this->styleId = (string)$styleId; return $this; } /** - * Check for Id and assign one if necessary + * Check for id and assign one if necessary * - * @return \FML\Stylesheet\Style3d + * @return \FML\Stylesheet\Style3d|static */ public function checkId() { - if (!$this->id) { - $this->id = uniqid(); + if (!$this->styleId) { + $this->setId(new UniqueID()); } return $this; } /** - * Get Style Id + * Get style id * * @return string */ public function getId() { - return $this->id; + return $this->styleId; } /** - * Set Model + * Set model * - * @param string $model Style Model - * @return \FML\Stylesheet\Style3d + * @param string $model Style model + * @return \FML\Stylesheet\Style3d|static */ public function setModel($model) { $this->model = (string)$model; @@ -101,10 +102,10 @@ class Style3d { } /** - * Set Thickness + * Set thickness * - * @param float $thickness Style Thickness - * @return \FML\Stylesheet\Style3d + * @param float $thickness Style thickness + * @return \FML\Stylesheet\Style3d|static */ public function setThickness($thickness) { $this->thickness = (float)$thickness; @@ -112,10 +113,10 @@ class Style3d { } /** - * Set Color + * Set color * - * @param string $color Style Color - * @return \FML\Stylesheet\Style3d + * @param string $color Style color + * @return \FML\Stylesheet\Style3d|static */ public function setColor($color) { $this->color = (string)$color; @@ -123,10 +124,10 @@ class Style3d { } /** - * Set Focus Color + * Set focus color * - * @param string $focusColor Style Focus Color - * @return \FML\Stylesheet\Style3d + * @param string $focusColor Style focus color + * @return \FML\Stylesheet\Style3d|static */ public function setFocusColor($focusColor) { $this->focusColor = (string)$focusColor; @@ -134,10 +135,10 @@ class Style3d { } /** - * Set Light Color + * Set light color * - * @param string $lightColor Light Color - * @return \FML\Stylesheet\Style3d + * @param string $lightColor Light color + * @return \FML\Stylesheet\Style3d|static */ public function setLightColor($lightColor) { $this->lightColor = (string)$lightColor; @@ -145,10 +146,10 @@ class Style3d { } /** - * Set Focus Light Color + * Set focus light color * - * @param string $focusLightColor Focus Light Color - * @return \FML\Stylesheet\Style3d + * @param string $focusLightColor Focus light color + * @return \FML\Stylesheet\Style3d|static */ public function setFocusLightColor($focusLightColor) { $this->focusLightColor = (string)$focusLightColor; @@ -156,10 +157,10 @@ class Style3d { } /** - * Set Y-Offset + * Set Y-offset * - * @param float $yOffset Y-Offset - * @return \FML\Stylesheet\Style3d + * @param float $yOffset Y-offset + * @return \FML\Stylesheet\Style3d|static */ public function setYOffset($yOffset) { $this->yOffset = (float)$yOffset; @@ -167,10 +168,10 @@ class Style3d { } /** - * Set Focus Y-Offset + * Set focus Y-offset * - * @param float $focusYOffset Focus Y-Offset - * @return \FML\Stylesheet\Style3d + * @param float $focusYOffset Focus Y-offset + * @return \FML\Stylesheet\Style3d|static */ public function setFocusYOffset($focusYOffset) { $this->focusYOffset = (float)$focusYOffset; @@ -178,10 +179,10 @@ class Style3d { } /** - * Set Z-Offset + * Set Z-offset * - * @param float $zOffset Z-Offset - * @return \FML\Stylesheet\Style3d + * @param float $zOffset Z-offset + * @return \FML\Stylesheet\Style3d|static */ public function setZOffset($zOffset) { $this->zOffset = (float)$zOffset; @@ -189,10 +190,10 @@ class Style3d { } /** - * Set Focus Z-Offset + * Set focus Z-offset * - * @param float $focusZOffset Focus Z-Offset - * @return \FML\Stylesheet\Style3d + * @param float $focusZOffset Focus Z-offset + * @return \FML\Stylesheet\Style3d|static */ public function setFocusZOffset($focusZOffset) { $this->focusZOffset = (float)$focusZOffset; @@ -200,16 +201,16 @@ class Style3d { } /** - * Render the Style3d XML Element + * Render the Style3d XML element * - * @param \DOMDocument $domDocument DomDocument for which the Style3d XML Element should be rendered + * @param \DOMDocument $domDocument DOMDocument for which the Style3d XML element should be rendered * @return \DOMElement */ public function render(\DOMDocument $domDocument) { $style3dXml = $domDocument->createElement($this->tagName); $this->checkId(); - if ($this->id) { - $style3dXml->setAttribute('id', $this->id); + if ($this->styleId) { + $style3dXml->setAttribute('id', $this->styleId); } if ($this->model) { $style3dXml->setAttribute('model', $this->model); diff --git a/application/core/Libs/FML/Stylesheet/Stylesheet.php b/application/core/Libs/FML/Stylesheet/Stylesheet.php index f483704e..8c73221a 100644 --- a/application/core/Libs/FML/Stylesheet/Stylesheet.php +++ b/application/core/Libs/FML/Stylesheet/Stylesheet.php @@ -3,7 +3,7 @@ namespace FML\Stylesheet; /** - * Class representing the ManiaLinks Stylesheet + * Class representing a ManiaLink Stylesheet * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -11,34 +11,28 @@ namespace FML\Stylesheet; */ class Stylesheet { /* - * Protected Properties + * Protected properties */ protected $tagName = 'stylesheet'; + /** @var Style3d[] $styles3d */ protected $styles3d = array(); /** @var Mood $mood */ protected $mood = null; /** - * Create a new Stylesheet Object + * Create a new Stylesheet object * - * @return \FML\Stylesheet\Stylesheet + * @return \FML\Stylesheet\Stylesheet|static */ public static function create() { - $stylesheet = new Stylesheet(); - return $stylesheet; - } - - /** - * Construct a new Stylesheet Object - */ - public function __construct() { + return new static(); } /** * Add a new Style3d * - * @param Style3d $style3d The Style3d to add - * @return \FML\Stylesheet\Stylesheet + * @param Style3d $style3d Style3d object + * @return \FML\Stylesheet\Stylesheet|static */ public function addStyle3d(Style3d $style3d) { if (!in_array($style3d, $this->styles3d, true)) { @@ -48,9 +42,9 @@ class Stylesheet { } /** - * Remove all Styles + * Remove all Style3ds * - * @return \FML\Stylesheet\Stylesheet + * @return \FML\Stylesheet\Stylesheet|static */ public function removeStyles() { $this->styles3d = array(); @@ -58,10 +52,10 @@ class Stylesheet { } /** - * Set the Mood Object of the Stylesheet + * Set the Mood object of the Stylesheet * - * @param Mood $mood Mood Object - * @return \FML\Stylesheet\Stylesheet + * @param Mood $mood Mood object + * @return \FML\Stylesheet\Stylesheet|static */ public function setMood(Mood $mood) { $this->mood = $mood; @@ -69,9 +63,9 @@ class Stylesheet { } /** - * Get the Mood Object + * Get the Mood object * - * @param bool $createIfEmpty (optional) Whether the Mood Object should be created if it's not set yet + * @param bool $createIfEmpty (optional) Whether the Mood object should be created if it's not set * @return \FML\Stylesheet\Mood */ public function getMood($createIfEmpty = true) { @@ -82,9 +76,9 @@ class Stylesheet { } /** - * Render the Stylesheet XML Element + * Render the Stylesheet XML element * - * @param \DOMDocument $domDocument DomDocument for which the Stylesheet XML Element should be rendered + * @param \DOMDocument $domDocument DOMDocument for which the Stylesheet XML element should be rendered * @return \DOMElement */ public function render(\DOMDocument $domDocument) { @@ -93,7 +87,6 @@ class Stylesheet { $stylesXml = $domDocument->createElement('frame3dstyles'); $stylesheetXml->appendChild($stylesXml); foreach ($this->styles3d as $style3d) { - /** @var Style3d $style3d */ $style3dXml = $style3d->render($domDocument); $stylesXml->appendChild($style3dXml); } diff --git a/application/core/Libs/FML/Types/Actionable.php b/application/core/Libs/FML/Types/Actionable.php index 2b887f1b..759d6e3c 100644 --- a/application/core/Libs/FML/Types/Actionable.php +++ b/application/core/Libs/FML/Types/Actionable.php @@ -3,55 +3,55 @@ namespace FML\Types; /** - * Interface for Elements that support the Action Attribute + * Interface for Elements that support the action attribute * - * @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 */ interface Actionable { /* * Constants */ - const ACTION_0 = '0'; - const ACTION_BACK = 'back'; - const ACTION_ENTER = 'enter'; - const ACTION_HOME = 'home'; - const ACTION_MENU_SOLO = 'menu_solo'; + const ACTION_0 = '0'; + const ACTION_BACK = 'back'; + const ACTION_ENTER = 'enter'; + const ACTION_HOME = 'home'; + const ACTION_MENU_SOLO = 'menu_solo'; const ACTION_MENU_COMPETITIONS = 'menu_competitions'; - const ACTION_MENU_LOCAL = 'menu_local'; - const ACTION_MENU_INTERNET = 'menu_internet'; - const ACTION_MENU_EDITORS = 'menu_editors'; - const ACTION_MENU_PROFILE = 'menu_profile'; - const ACTION_QUIT = 'quit'; - const ACTION_QUITSERVER = 'maniaplanet:quitserver'; - const ACTION_SAVEREPLAY = 'maniaplanet:savereplay'; - const ACTION_TOGGLESPEC = 'maniaplanet:togglespec'; - const ACTIONKEY_F5 = 1; - const ACTIONKEY_F6 = 2; - const ACTIONKEY_F7 = 3; - const ACTIONKEY_F8 = 4; + const ACTION_MENU_LOCAL = 'menu_local'; + const ACTION_MENU_INTERNET = 'menu_internet'; + const ACTION_MENU_EDITORS = 'menu_editors'; + const ACTION_MENU_PROFILE = 'menu_profile'; + const ACTION_QUIT = 'quit'; + const ACTION_QUITSERVER = 'maniaplanet:quitserver'; + const ACTION_SAVEREPLAY = 'maniaplanet:savereplay'; + const ACTION_TOGGLESPEC = 'maniaplanet:togglespec'; + const ACTIONKEY_F5 = 1; + const ACTIONKEY_F6 = 2; + const ACTIONKEY_F7 = 3; + const ACTIONKEY_F8 = 4; /** - * Set Action + * Set action * - * @param string $action Action Name - * @return \FML\Types\Actionable + * @param string $action Action name + * @return \FML\Types\Actionable|static */ public function setAction($action); /** - * Get the assigned Action + * Get the assigned action * - * @return string + * @return string */ public function getAction(); /** - * Set Action Key + * Set action key * - * @param int $actionKey Action Key Number - * @return \FML\Types\Actionable + * @param int $actionKey Action key + * @return \FML\Types\Actionable|static */ public function setActionKey($actionKey); } diff --git a/application/core/Libs/FML/Types/BgColorable.php b/application/core/Libs/FML/Types/BgColorable.php index 7fc2c72b..96264016 100644 --- a/application/core/Libs/FML/Types/BgColorable.php +++ b/application/core/Libs/FML/Types/BgColorable.php @@ -3,19 +3,19 @@ namespace FML\Types; /** - * Interface for Elements with Background Color Attribute + * Interface for Elements with background color attribute * - * @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 */ interface BgColorable { /** - * Set Background Color + * Set background color * - * @param string $bgColor Background Color - * @return \FML\Types\BgColorable + * @param string $bgColor Background color + * @return \FML\Types\BgColorable|static */ public function setBgColor($bgColor); } diff --git a/application/core/Libs/FML/Types/Container.php b/application/core/Libs/FML/Types/Container.php index 792c049d..003d7013 100644 --- a/application/core/Libs/FML/Types/Container.php +++ b/application/core/Libs/FML/Types/Container.php @@ -14,33 +14,33 @@ use FML\Elements\Format; interface Container { /** - * Add a new Child Element + * Add a new child Element * - * @param Renderable $child The Child Control to add - * @return \FML\Types\Container + * @param Renderable $child Child Control to add + * @return \FML\Types\Container|static */ public function add(Renderable $child); /** - * Remove all Children + * Remove all children * - * @return \FML\Types\Container + * @return \FML\Types\Container|static */ public function removeChildren(); /** - * Set the Format Object of the Container + * Set the Format object of the Container * - * @param Format $format New Format Object - * @return \FML\Types\Container + * @param Format $format New Format object + * @return \FML\Types\Container|static */ public function setFormat(Format $format); /** - * Get the Format Object of the Container + * Get the Format object of the Container * - * @param bool $createIfEmpty (optional) Whether the Format Object should be created if it's not set yet - * @return \FML\Elements\Format + * @param bool $createIfEmpty (optional) Whether the Format object should be created if it's not set + * @return \FML\Elements\Format|static */ public function getFormat($createIfEmpty = true); } diff --git a/application/core/Libs/FML/Types/Linkable.php b/application/core/Libs/FML/Types/Linkable.php index 301b8ec8..44da85a3 100644 --- a/application/core/Libs/FML/Types/Linkable.php +++ b/application/core/Libs/FML/Types/Linkable.php @@ -3,7 +3,7 @@ namespace FML\Types; /** - * Interface for Elements with Url Attributes + * Interface for Elements with url attributes * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -12,34 +12,34 @@ namespace FML\Types; interface Linkable { /** - * Set Url + * Set url * - * @param string $url Link Url - * @return \FML\Types\Linkable + * @param string $url Link url + * @return \FML\Types\Linkable|static */ public function setUrl($url); /** - * Set Url Id to use from the Dico + * Set url id to use from Dico * - * @param string $urlId - * @return \FML\Types\Linkable + * @param string $urlId Url id + * @return \FML\Types\Linkable|static */ public function setUrlId($urlId); /** - * Set Manialink + * Set manialink * - * @param string $manialink Manialink Name - * @return \FML\Types\Linkable + * @param string $manialink Manialink name + * @return \FML\Types\Linkable|static */ public function setManialink($manialink); /** - * Set Manialink Id to use from the Dico + * Set manialink id to use from Dico * - * @param string $manialinkId Manialink Id - * @return \FML\Types\Linkable + * @param string $manialinkId Manialink id + * @return \FML\Types\Linkable|static */ public function setManialinkId($manialinkId); } diff --git a/application/core/Libs/FML/Types/NewLineable.php b/application/core/Libs/FML/Types/NewLineable.php index 03ea5483..61926a32 100644 --- a/application/core/Libs/FML/Types/NewLineable.php +++ b/application/core/Libs/FML/Types/NewLineable.php @@ -3,7 +3,7 @@ namespace FML\Types; /** - * Interface for Elements with AutoNewLine Attribute + * Interface for Elements with autonewline attribute * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -12,10 +12,10 @@ namespace FML\Types; interface NewLineable { /** - * Set Auto New Line + * Set auto new line * - * @param bool $autoNewLine Whether the Control should insert New Lines automatically - * @return \FML\Types\NewLineable + * @param bool $autoNewLine Whether the Control should insert new lines automatically + * @return \FML\Types\NewLineable|static */ public function setAutoNewLine($autoNewLine); } diff --git a/application/core/Libs/FML/Types/Playable.php b/application/core/Libs/FML/Types/Playable.php index c796e26d..8cf70701 100644 --- a/application/core/Libs/FML/Types/Playable.php +++ b/application/core/Libs/FML/Types/Playable.php @@ -3,7 +3,7 @@ namespace FML\Types; /** - * Interface for Elements with Media Attributes + * Interface for Elements with media attributes * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -12,50 +12,50 @@ namespace FML\Types; interface Playable { /** - * Set Data + * Set data * - * @param string $data Media Url - * @return \FML\Types\Playable + * @param string $data Media url + * @return \FML\Types\Playable|static */ public function setData($data); /** - * Set Data Id to use from the Dico + * Set data id to use from Dico * - * @param string $dataId - * @return \FML\Types\Playable + * @param string $dataId Data id + * @return \FML\Types\Playable|static */ public function setDataId($dataId); /** - * Set Play + * Set play * * @param bool $play Whether the Control should start playing automatically - * @return \FML\Types\Playable + * @return \FML\Types\Playable|static */ public function setPlay($play); /** - * Set Looping + * Set looping * * @param bool $looping Whether the Control should play looping - * @return \FML\Types\Playable + * @return \FML\Types\Playable|static */ public function setLooping($looping); /** - * Set Music + * Set music * - * @param bool $music Whether the Control represents Background Music - * @return \FML\Types\Playable + * @param bool $music Whether the Control represents background music + * @return \FML\Types\Playable|static */ public function setMusic($music); /** - * Set Volume + * Set volume * - * @param float $volume Media Volume - * @return \FML\Types\Playable + * @param float $volume Media volume + * @return \FML\Types\Playable|static */ public function setVolume($volume); } diff --git a/application/core/Libs/FML/Types/Renderable.php b/application/core/Libs/FML/Types/Renderable.php index 48761eca..24e54240 100644 --- a/application/core/Libs/FML/Types/Renderable.php +++ b/application/core/Libs/FML/Types/Renderable.php @@ -12,9 +12,9 @@ namespace FML\Types; interface Renderable { /** - * Render the XML Element + * Render the XML element * - * @param \DOMDocument $domDocument DomDocument for which the XML Element should be rendered + * @param \DOMDocument $domDocument DOMDocument for which the XML element should be rendered * @return \DOMElement */ public function render(\DOMDocument $domDocument); diff --git a/application/core/Libs/FML/Types/ScriptFeatureable.php b/application/core/Libs/FML/Types/ScriptFeatureable.php index 709c761a..2c6db6ba 100644 --- a/application/core/Libs/FML/Types/ScriptFeatureable.php +++ b/application/core/Libs/FML/Types/ScriptFeatureable.php @@ -3,7 +3,7 @@ namespace FML\Types; /** - * Interface for Elements supporting Script Features + * Interface for Elements supporting ScriptFeatures * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -14,7 +14,7 @@ interface ScriptFeatureable { /** * Get the assigned Script Features of the Element * - * @return array + * @return \FML\Script\Features\ScriptFeature[] */ public function getScriptFeatures(); } diff --git a/application/core/Libs/FML/Types/Scriptable.php b/application/core/Libs/FML/Types/Scriptable.php index 8f3ce3dc..cb6d6a4f 100644 --- a/application/core/Libs/FML/Types/Scriptable.php +++ b/application/core/Libs/FML/Types/Scriptable.php @@ -3,7 +3,7 @@ namespace FML\Types; /** - * Interface for Elements with ScriptEvents Attribute + * Interface for Elements with scriptevents attribute * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -12,10 +12,10 @@ namespace FML\Types; interface Scriptable { /** - * Set ScriptEvents + * Set script events * - * @param bool $scriptEvents Whether Script Events should be enabled - * @return \FML\Types\Scriptable + * @param bool $scriptEvents Whether script events should be enabled + * @return \FML\Types\Scriptable|static */ public function setScriptEvents($scriptEvents); } diff --git a/application/core/Libs/FML/Types/Styleable.php b/application/core/Libs/FML/Types/Styleable.php index 77d131bb..6107f035 100644 --- a/application/core/Libs/FML/Types/Styleable.php +++ b/application/core/Libs/FML/Types/Styleable.php @@ -3,7 +3,7 @@ namespace FML\Types; /** - * Interface for Elements with Style Attribute + * Interface for Elements with style attribute * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -12,10 +12,10 @@ namespace FML\Types; interface Styleable { /** - * Set Style + * Set style * - * @param string $style Style Name - * @return \FML\Types\Styleable + * @param string $style Style name + * @return \FML\Types\Styleable|static */ public function setStyle($style); } diff --git a/application/core/Libs/FML/Types/SubStyleable.php b/application/core/Libs/FML/Types/SubStyleable.php index 2041b6e8..1b8c16f9 100644 --- a/application/core/Libs/FML/Types/SubStyleable.php +++ b/application/core/Libs/FML/Types/SubStyleable.php @@ -3,7 +3,7 @@ namespace FML\Types; /** - * Interface for Elements with SubStyle Attribute + * Interface for Elements with substyle attribute * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -12,19 +12,19 @@ namespace FML\Types; interface SubStyleable { /** - * Set SubStyle + * Set sub style * - * @param string $subStyle SubStyle Name - * @return \FML\Types\SubStyleable + * @param string $subStyle SubStyle name + * @return \FML\Types\SubStyleable|static */ public function setSubStyle($subStyle); /** - * Set Style and SubStyle + * Set style and sub style * - * @param string $style Style Name - * @param string $subStyle SubStyle Name - * @return \FML\Types\SubStyleable + * @param string $style Style name + * @param string $subStyle SubStyle name + * @return \FML\Types\SubStyleable|static */ public function setStyles($style, $subStyle); } diff --git a/application/core/Libs/FML/Types/TextFormatable.php b/application/core/Libs/FML/Types/TextFormatable.php index 9a9ce0b9..d25959f5 100644 --- a/application/core/Libs/FML/Types/TextFormatable.php +++ b/application/core/Libs/FML/Types/TextFormatable.php @@ -3,7 +3,7 @@ namespace FML\Types; /** - * Interface for Elements with Formatable Text + * Interface for Elements with formatable text * * @author steeffeen * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder @@ -12,34 +12,34 @@ namespace FML\Types; interface TextFormatable { /** - * Set Text Size + * Set text size * - * @param int $textSize Text Size - * @return \FML\Types\TextFormatable + * @param int $textSize Text size + * @return \FML\Types\TextFormatable|static */ public function setTextSize($textSize); /** - * Set Text Color + * Set text color * - * @param string $textColor Text Color - * @return \FML\Types\TextFormatable + * @param string $textColor Text color + * @return \FML\Types\TextFormatable|static */ public function setTextColor($textColor); /** - * Set Area Color + * Set area color * - * @param string $areaColor Area Color - * @return \FML\Types\TextFormatable + * @param string $areaColor Area color + * @return \FML\Types\TextFormatable|static */ public function setAreaColor($areaColor); /** - * Set Area Focus Color + * Set area focus color * - * @param string $areaFocusColor Area Focus Color - * @return \FML\Types\TextFormatable + * @param string $areaFocusColor Area focus color + * @return \FML\Types\TextFormatable|static */ public function setAreaFocusColor($areaFocusColor); } diff --git a/application/core/Libs/FML/UniqueID.php b/application/core/Libs/FML/UniqueID.php new file mode 100644 index 00000000..278a3d89 --- /dev/null +++ b/application/core/Libs/FML/UniqueID.php @@ -0,0 +1,71 @@ +index = static::newIndex(); + } + + /** + * Get the Unique ID value + * + * @return string + */ + public function getValue() { + return self::PREFIX . $this->index; + } + + /** + * Get the string representation + * + * @return string + */ + public function __toString() { + return $this->getValue(); + } +} diff --git a/application/core/Libs/FML/autoload.php b/application/core/Libs/FML/autoload.php index 00174290..b4d5d5fc 100644 --- a/application/core/Libs/FML/autoload.php +++ b/application/core/Libs/FML/autoload.php @@ -4,7 +4,7 @@ * FancyManiaLinks - Automatic ManiaLink Generator Framework * * @author steeffeen - * @version 1.2 + * @version 1.3 * @link http://github.com/steeffeen/FancyManiaLinks * @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 @@ -13,12 +13,11 @@ if (!defined('FML_PATH')) { define('FML_PATH', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR); } if (!defined('FML_VERSION')) { - define('FML_VERSION', '1.2'); + define('FML_VERSION', '1.3'); } -//define('FML_SIMPLE_CLASSES', true); /* - * Autoload Function that loads FML Class Files on Demand + * Autoload function that loads FML class files on demand */ if (!defined('FML_AUTOLOAD_DEFINED')) { define('FML_AUTOLOAD_DEFINED', true); @@ -26,57 +25,7 @@ if (!defined('FML_AUTOLOAD_DEFINED')) { $classPath = str_replace('\\', DIRECTORY_SEPARATOR, $className); $filePath = FML_PATH . $classPath . '.php'; if (file_exists($filePath)) { - // Load with FML namespace require_once $filePath; - } else if (defined('FML_SIMPLE_CLASSES') && FML_SIMPLE_CLASSES) { - // Load as simple class name - if (!function_exists('loadSimpleClass')) { - - /** - * Load FML Class Files from the given Directory - * - * @param string $className Class to load - * @param string $directory Directory to open - * @param array $excludes File Names to ignore - * @param string $baseNamespace Base Namespace - * @return bool - */ - function loadSimpleClass($className, $directory, $excludes, $baseNamespace) { - if ($dirHandle = opendir($directory)) { - $classParts = explode('\\', $className); - $simpleClassName = end($classParts); - $classFileName = $simpleClassName . '.php'; - while ($fileName = readdir($dirHandle)) { - if (in_array($fileName, $excludes)) { - continue; - } - $filePath = $directory . $fileName; - if (is_dir($filePath)) { - $subDirectory = $filePath . DIRECTORY_SEPARATOR; - $namespace = $baseNamespace . $fileName . '\\'; - $success = loadSimpleClass($className, $subDirectory, $excludes, $namespace); - if ($success) { - return true; - } - continue; - } - if (is_file($filePath)) { - if ($fileName == $classFileName) { - require_once $filePath; - class_alias($baseNamespace . $simpleClassName, $className, false); - return true; - } - continue; - } - } - closedir($dirHandle); - } - return false; - } - } - $excludes = array('.', '..'); - $baseNamespace = 'FML\\'; - loadSimpleClass($className, FML_PATH . 'FML' . DIRECTORY_SEPARATOR, $excludes, $baseNamespace); } }); }