Updated FML to newest version
This commit is contained in:
		
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -43,8 +43,8 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF | ||||
|     protected $selectText = null; | ||||
|  | ||||
|     /** | ||||
|      * @deprecated | ||||
|      * @var bool $autoNewLine Auto new line | ||||
|      * @deprecated | ||||
|      */ | ||||
|     protected $autoNewLine = null; | ||||
|  | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
| namespace FML\Controls; | ||||
|  | ||||
| use FML\Elements\Format; | ||||
| use FML\Stylesheet\Style; | ||||
| use FML\Types\Container; | ||||
| use FML\Types\Renderable; | ||||
| use FML\Types\ScriptFeatureable; | ||||
| @@ -25,6 +26,7 @@ class Frame extends Control implements Container | ||||
|  | ||||
|     /** | ||||
|      * @var Format $format Format | ||||
|      * @deprecated | ||||
|      */ | ||||
|     protected $format = null; | ||||
|  | ||||
| @@ -37,8 +39,8 @@ class Frame extends Control implements Container | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see        Container::addChild() | ||||
|      * @deprecated use addChild() instead | ||||
|      * @deprecated Use addChild() | ||||
|      * @see        Frame::addChild() | ||||
|      */ | ||||
|     public function add(Renderable $child) | ||||
|     { | ||||
| @@ -67,6 +69,15 @@ class Frame extends Control implements Container | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated Use removeAllChildren() | ||||
|      * @see        Frame::removeAllChildren() | ||||
|      */ | ||||
|     public function removeChildren() | ||||
|     { | ||||
|         return $this->removeAllChildren(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Container::removeAllChildren() | ||||
|      */ | ||||
| @@ -77,15 +88,20 @@ class Frame extends Control implements Container | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Container::getFormat() | ||||
|      * @deprecated Use Style | ||||
|      * @see        Style | ||||
|      */ | ||||
|     public function getFormat() | ||||
|     public function getFormat($createIfEmpty = true) | ||||
|     { | ||||
|         if (!$this->format && $createIfEmpty) { | ||||
|             $this->setFormat(new Format()); | ||||
|         } | ||||
|         return $this->format; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Container::setFormat() | ||||
|      * @deprecated Use Style | ||||
|      * @see        Style | ||||
|      */ | ||||
|     public function setFormat(Format $format = null) | ||||
|     { | ||||
|   | ||||
| @@ -19,16 +19,21 @@ class Frame3d extends Frame implements Scriptable | ||||
|     /* | ||||
|      * Constants | ||||
|      */ | ||||
|     const STYLE_BaseStation = 'BaseStation'; | ||||
|     const STYLE_BaseBoxCase = 'BaseBoxCase'; | ||||
|     const STYLE_TitleLogo   = 'Titlelogo'; | ||||
|     const STYLE_ButtonBack  = 'ButtonBack'; | ||||
|     const STYLE_ButtonNav   = 'ButtonNav'; | ||||
|     const STYLE_ButtonH     = 'ButtonH'; | ||||
|     const STYLE_Station3x3  = 'Station3x3'; | ||||
|     const STYLE_Title       = 'Title'; | ||||
|     const STYLE_TitleEditor = 'TitleEditor'; | ||||
|     const STYLE_Window      = 'Window'; | ||||
|     const STYLE_BaseStation = "BaseStation"; | ||||
|     const STYLE_BaseBoxCase = "BaseBoxCase"; | ||||
|     const STYLE_TitleLogo   = "TitleLogo"; | ||||
|     /** | ||||
|      * @deprecated Use STYLE_TitleLogo | ||||
|      * @see        Frame3d::STYLE_TitleLogo | ||||
|      */ | ||||
|     const STYLE_Titlelogo   = "Titlelogo"; | ||||
|     const STYLE_ButtonBack  = "ButtonBack"; | ||||
|     const STYLE_ButtonNav   = "ButtonNav"; | ||||
|     const STYLE_ButtonH     = "ButtonH"; | ||||
|     const STYLE_Station3x3  = "Station3x3"; | ||||
|     const STYLE_Title       = "Title"; | ||||
|     const STYLE_TitleEditor = "TitleEditor"; | ||||
|     const STYLE_Window      = "Window"; | ||||
|  | ||||
|     /** | ||||
|      * @var string $style3dId Style3d id | ||||
|   | ||||
| @@ -25,6 +25,34 @@ class FrameInstance extends Control | ||||
|      */ | ||||
|     protected $model = null; | ||||
|  | ||||
|     /** | ||||
|      * Create a new Frame Instance | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $controlId (optional) Control Id | ||||
|      * @param string $modelId   (optional) Model Id | ||||
|      * @return static | ||||
|      */ | ||||
|     public static function create($controlId = null, $modelId = null) | ||||
|     { | ||||
|         return new static($controlId, $modelId); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Construct a new Frame Instance | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $controlId (optional) Control Id | ||||
|      * @param string $modelId   (optional) Model Id | ||||
|      */ | ||||
|     public function __construct($controlId = null, $modelId = null) | ||||
|     { | ||||
|         parent::__construct($controlId); | ||||
|         if ($modelId) { | ||||
|             $this->setModelId($modelId); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the FrameModel id | ||||
|      * | ||||
|   | ||||
| @@ -192,9 +192,10 @@ class Gauge extends Control implements Colorable, Styleable | ||||
|      * Set draw background | ||||
|      * | ||||
|      * @api | ||||
|      * @param bool $drawBackground If the Gauges background should be drawn | ||||
|      * @param bool $drawBackground If the Gauge background should be drawn | ||||
|      * @return static | ||||
|      * @deprecated use setDrawBackground() instead | ||||
|      * @deprecated Use setDrawBackground() | ||||
|      * @see        Gauge::setDrawBackground() | ||||
|      */ | ||||
|     public function setDrawBg($drawBackground) | ||||
|     { | ||||
| @@ -205,7 +206,7 @@ class Gauge extends Control implements Colorable, Styleable | ||||
|      * Set draw background | ||||
|      * | ||||
|      * @api | ||||
|      * @param bool $drawBackground If the Gauges background should be drawn | ||||
|      * @param bool $drawBackground If the Gauge background should be drawn | ||||
|      * @return static | ||||
|      */ | ||||
|     public function setDrawBackground($drawBackground) | ||||
| @@ -229,7 +230,7 @@ class Gauge extends Control implements Colorable, Styleable | ||||
|      * Set draw block background | ||||
|      * | ||||
|      * @api | ||||
|      * @param bool $drawBlockBackground If the Gauges block background should be drawn | ||||
|      * @param bool $drawBlockBackground If the Gauge block background should be drawn | ||||
|      * @return static | ||||
|      */ | ||||
|     public function setDrawBlockBackground($drawBlockBackground) | ||||
| @@ -280,7 +281,7 @@ class Gauge extends Control implements Colorable, Styleable | ||||
|         if ($this->ratio) { | ||||
|             $domElement->setAttribute("ratio", $this->ratio); | ||||
|         } | ||||
|         if ($this->grading != 1.) { | ||||
|         if ($this->grading !== 1.) { | ||||
|             $domElement->setAttribute("grading", $this->grading); | ||||
|         } | ||||
|         if ($this->color) { | ||||
|   | ||||
| @@ -95,7 +95,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, MultiL | ||||
|     /** | ||||
|      * @var float $lineSpacing Line spacing | ||||
|      */ | ||||
|     protected $lineSpacing = -1.; | ||||
|     protected $lineSpacing = 1.; | ||||
|  | ||||
|     /** | ||||
|      * @var bool $scriptEvents Script events usage | ||||
| @@ -669,7 +669,7 @@ class Label extends Control implements Actionable, Linkable, NewLineable, MultiL | ||||
|         if ($this->autoNewLine) { | ||||
|             $domElement->setAttribute("autonewline", $this->autoNewLine); | ||||
|         } | ||||
|         if ($this->lineSpacing) { | ||||
|         if ($this->lineSpacing !== 1.) { | ||||
|             $domElement->setAttribute("linespacing", $this->lineSpacing); | ||||
|         } | ||||
|         if ($this->maxLines > 0) { | ||||
|   | ||||
| @@ -2,8 +2,10 @@ | ||||
|  | ||||
| namespace FML\Controls; | ||||
|  | ||||
| use FML\Components\CheckBoxDesign; | ||||
| use FML\Types\Actionable; | ||||
| use FML\Types\BackgroundColorable; | ||||
| use FML\Types\BgColorable; | ||||
| use FML\Types\Imageable; | ||||
| use FML\Types\Linkable; | ||||
| use FML\Types\Scriptable; | ||||
| @@ -18,7 +20,7 @@ use FML\Types\SubStyleable; | ||||
|  * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder | ||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  */ | ||||
| class Quad extends Control implements Actionable, BackgroundColorable, Imageable, Linkable, Scriptable, Styleable, SubStyleable | ||||
| class Quad extends Control implements Actionable, BackgroundColorable, BgColorable, Imageable, Linkable, Scriptable, Styleable, SubStyleable | ||||
| { | ||||
|  | ||||
|     /* | ||||
| @@ -83,6 +85,11 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable | ||||
|      */ | ||||
|     protected $backgroundColor = null; | ||||
|  | ||||
|     /** | ||||
|      * @var string $focusBackgroundColor Focus background color | ||||
|      */ | ||||
|     protected $focusBackgroundColor = null; | ||||
|  | ||||
|     /** | ||||
|      * @var string $action Action name | ||||
|      */ | ||||
| @@ -152,7 +159,8 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated use setImageUrl() instead | ||||
|      * @deprecated Use setImageUrl() | ||||
|      * @see        Quad::setImageUrl() | ||||
|      */ | ||||
|     public function setImage($imageUrl) | ||||
|     { | ||||
| @@ -204,9 +212,13 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param $imageFocusUrl | ||||
|      * @return \FML\Controls\Quad | ||||
|      * @deprecated | ||||
|      * Set the focus image url | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $imageFocusUrl Focus image url | ||||
|      * @return static | ||||
|      * @deprecated Use setImageFocusUrl() | ||||
|      * @see        Quad::setImageFocusUrl() | ||||
|      */ | ||||
|     public function setImageFocus($imageFocusUrl) | ||||
|     { | ||||
| @@ -403,7 +415,7 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see BackgroundColorable::setBgColor() | ||||
|      * @see BackgroundColorable::setBackgroundColor() | ||||
|      */ | ||||
|     public function setBackgroundColor($backgroundColor) | ||||
|     { | ||||
| @@ -411,6 +423,32 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated Use setBackgroundColor() | ||||
|      * @see        Quad::setBackgroundColor() | ||||
|      */ | ||||
|     public function setBgColor($bgColor) | ||||
|     { | ||||
|         return $this->setBackgroundColor($bgColor); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see BackgroundColorable::getFocusBackgroundColor() | ||||
|      */ | ||||
|     public function getFocusBackgroundColor() | ||||
|     { | ||||
|         return $this->focusBackgroundColor; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see BackgroundColorable::setFocusBackgroundColor() | ||||
|      */ | ||||
|     public function setFocusBackgroundColor($focusBackgroundColor) | ||||
|     { | ||||
|         $this->focusBackgroundColor = (string)$focusBackgroundColor; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Actionable::getAction() | ||||
|      */ | ||||
| @@ -632,6 +670,19 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Apply the CheckBox Design | ||||
|      * | ||||
|      * @api | ||||
|      * @param CheckBoxDesign $checkBoxDesign CheckBox Design | ||||
|      * @return static | ||||
|      */ | ||||
|     public function applyCheckBoxDesign(CheckBoxDesign $checkBoxDesign) | ||||
|     { | ||||
|         $checkBoxDesign->applyToQuad($this); | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Control::getTagName() | ||||
|      */ | ||||
| @@ -687,6 +738,9 @@ class Quad extends Control implements Actionable, BackgroundColorable, Imageable | ||||
|         if ($this->backgroundColor) { | ||||
|             $domElement->setAttribute("bgcolor", $this->backgroundColor); | ||||
|         } | ||||
|         if ($this->focusBackgroundColor) { | ||||
|             $domElement->setAttribute("bgcolorfocus", $this->focusBackgroundColor); | ||||
|         } | ||||
|         if ($this->action) { | ||||
|             $domElement->setAttribute("action", $this->action); | ||||
|         } | ||||
|   | ||||
| @@ -39,7 +39,7 @@ class TextEdit extends Control implements MultiLineable, Scriptable, Styleable, | ||||
|     /** | ||||
|      * @var float $lineSpacing Line spacing | ||||
|      */ | ||||
|     protected $lineSpacing = -1.; | ||||
|     protected $lineSpacing = 1.; | ||||
|  | ||||
|     /** | ||||
|      * @var int $maxLines Maximum number of lines | ||||
| @@ -406,7 +406,7 @@ class TextEdit extends Control implements MultiLineable, Scriptable, Styleable, | ||||
|         if ($this->autoNewLine) { | ||||
|             $domElement->setAttribute("autonewline", 1); | ||||
|         } | ||||
|         if ($this->lineSpacing > 0) { | ||||
|         if ($this->lineSpacing !== 1.) { | ||||
|             $domElement->setAttribute("linespacing", $this->lineSpacing); | ||||
|         } | ||||
|         if ($this->maxLines > 0) { | ||||
|   | ||||
| @@ -215,15 +215,19 @@ class Dico | ||||
|      * Remove entries of the given id | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $entryId Entry id that should be removed | ||||
|      * @param string $entryId  Entry id that should be removed | ||||
|      * @param string $language (optional) Only remove entry from the given language | ||||
|      * @return static | ||||
|      */ | ||||
|     public function removeEntry($entryId) | ||||
|     public function removeEntry($entryId, $language = null) | ||||
|     { | ||||
|         $entryId = (string)$entryId; | ||||
|         foreach ($this->entries as $language => $entries) { | ||||
|             if (isset($this->entries[$language][$entryId])) { | ||||
|                 unset($this->entries[$language][$entryId]); | ||||
|         foreach ($this->entries as $languageKey => $entries) { | ||||
|             if ($language && $language !== $languageKey) { | ||||
|                 continue; | ||||
|             } | ||||
|             if (isset($this->entries[$languageKey][$entryId])) { | ||||
|                 unset($this->entries[$languageKey][$entryId]); | ||||
|             } | ||||
|         } | ||||
|         return $this; | ||||
| @@ -245,6 +249,19 @@ class Dico | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Remove entries | ||||
|      * | ||||
|      * @api | ||||
|      * @return static | ||||
|      * @deprecated Use removeAllEntries() | ||||
|      * @see        Dico::removeAllEntries() | ||||
|      */ | ||||
|     public function removeEntries() | ||||
|     { | ||||
|         return $this->removeAllEntries(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Remove all entries | ||||
|      * | ||||
|   | ||||
| @@ -2,7 +2,9 @@ | ||||
|  | ||||
| namespace FML\Elements; | ||||
|  | ||||
| use FML\Stylesheet\Style; | ||||
| use FML\Types\BackgroundColorable; | ||||
| use FML\Types\BgColorable; | ||||
| use FML\Types\Renderable; | ||||
| use FML\Types\Styleable; | ||||
| use FML\Types\TextFormatable; | ||||
| @@ -10,11 +12,13 @@ use FML\Types\TextFormatable; | ||||
| /** | ||||
|  * Format Element | ||||
|  * | ||||
|  * @author    steeffeen <mail@steeffeen.com> | ||||
|  * @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder | ||||
|  * @license   http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  * @author     steeffeen <mail@steeffeen.com> | ||||
|  * @copyright  FancyManiaLinks Copyright © 2017 Steffen Schröder | ||||
|  * @license    http://www.gnu.org/licenses/ GNU General Public License, Version 3 | ||||
|  * @deprecated Use Style | ||||
|  * @see        Style | ||||
|  */ | ||||
| class Format implements BackgroundColorable, Renderable, Styleable, TextFormatable | ||||
| class Format implements BackgroundColorable, BgColorable, Renderable, Styleable, TextFormatable | ||||
| { | ||||
|  | ||||
|     /** | ||||
| @@ -22,6 +26,11 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab | ||||
|      */ | ||||
|     protected $backgroundColor = null; | ||||
|  | ||||
|     /** | ||||
|      * @var string $focusBackgroundColor Focus background color | ||||
|      */ | ||||
|     protected $focusBackgroundColor = null; | ||||
|  | ||||
|     /** | ||||
|      * @var string $style Style | ||||
|      */ | ||||
| @@ -64,7 +73,7 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see BgColorable::getBackgroundColor() | ||||
|      * @see BackgroundColorable::getBackgroundColor() | ||||
|      */ | ||||
|     public function getBackgroundColor() | ||||
|     { | ||||
| @@ -72,7 +81,7 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see BgColorable::setBackgroundColor() | ||||
|      * @see BackgroundColorable::setBackgroundColor() | ||||
|      */ | ||||
|     public function setBackgroundColor($backgroundColor) | ||||
|     { | ||||
| @@ -80,6 +89,32 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated Use setBackgroundColor() | ||||
|      * @see        Format::setBackgroundColor() | ||||
|      */ | ||||
|     public function setBgColor($bgColor) | ||||
|     { | ||||
|         return $this->setBackgroundColor($bgColor); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see BackgroundColorable::getFocusBackgroundColor() | ||||
|      */ | ||||
|     public function getFocusBackgroundColor() | ||||
|     { | ||||
|         return $this->focusBackgroundColor; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see BackgroundColorable::setFocusBackgroundColor() | ||||
|      */ | ||||
|     public function setFocusBackgroundColor($focusBackgroundColor) | ||||
|     { | ||||
|         $this->focusBackgroundColor = (string)$focusBackgroundColor; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Styleable::getStyle() | ||||
|      */ | ||||
| @@ -191,6 +226,9 @@ class Format implements BackgroundColorable, Renderable, Styleable, TextFormatab | ||||
|         if ($this->backgroundColor) { | ||||
|             $domElement->setAttribute("bgcolor", $this->backgroundColor); | ||||
|         } | ||||
|         if ($this->focusBackgroundColor) { | ||||
|             $domElement->setAttribute("bgcolorfocus", $this->focusBackgroundColor); | ||||
|         } | ||||
|         if ($this->style) { | ||||
|             $domElement->setAttribute("style", $this->style); | ||||
|         } | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
|  | ||||
| namespace FML\Elements; | ||||
|  | ||||
| use FML\Stylesheet\Style; | ||||
| use FML\Types\Container; | ||||
| use FML\Types\Identifiable; | ||||
| use FML\Types\Renderable; | ||||
| @@ -113,14 +114,23 @@ class FrameModel implements Container, Identifiable, Renderable | ||||
|     /** | ||||
|      * @see Container::addChild() | ||||
|      */ | ||||
|     public function addChild(Renderable $childElement) | ||||
|     public function addChild(Renderable $child) | ||||
|     { | ||||
|         if (!in_array($childElement, $this->children, true)) { | ||||
|             array_push($this->children, $childElement); | ||||
|         if (!in_array($child, $this->children, true)) { | ||||
|             array_push($this->children, $child); | ||||
|         } | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated Use addChild() | ||||
|      * @see        FrameModel::addChild() | ||||
|      */ | ||||
|     public function add(Renderable $child) | ||||
|     { | ||||
|         return $this->addChild($child); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Container::addChildren() | ||||
|      */ | ||||
| @@ -142,15 +152,29 @@ class FrameModel implements Container, Identifiable, Renderable | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Container::getFormat() | ||||
|      * @deprecated Use removeAllChildren() | ||||
|      * @see        FrameModel::removeAllChildren() | ||||
|      */ | ||||
|     public function getFormat() | ||||
|     public function removeChildren() | ||||
|     { | ||||
|         return $this->removeAllChildren(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @deprecated Use Style | ||||
|      * @see        Style | ||||
|      */ | ||||
|     public function getFormat($createIfEmpty = true) | ||||
|     { | ||||
|         if (!$this->format && $createIfEmpty) { | ||||
|             $this->setFormat(new Format()); | ||||
|         } | ||||
|         return $this->format; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @see Container::setFormat() | ||||
|      * @deprecated Use Style | ||||
|      * @see        Style | ||||
|      */ | ||||
|     public function setFormat(Format $format = null) | ||||
|     { | ||||
|   | ||||
| @@ -232,12 +232,13 @@ class ManiaCode | ||||
|      * Join a server | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $login Server login | ||||
|      * @param string $loginOrIp (optional) Server login or ip | ||||
|      * @param int    $port      (optional) Server port | ||||
|      * @return static | ||||
|      */ | ||||
|     public function addJoinServer($login) | ||||
|     public function addJoinServer($loginOrIp = null, $port = null) | ||||
|     { | ||||
|         $serverElement = new JoinServer($login); | ||||
|         $serverElement = new JoinServer($loginOrIp, $port); | ||||
|         return $this->addElement($serverElement); | ||||
|     } | ||||
|  | ||||
| @@ -245,12 +246,13 @@ class ManiaCode | ||||
|      * Add a server as favorite | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $login Server login | ||||
|      * @param string $loginOrIp (optional) Server login or ip | ||||
|      * @param int    $port      (optional) Server port | ||||
|      * @return static | ||||
|      */ | ||||
|     public function addAddFavorite($login) | ||||
|     public function addAddFavorite($loginOrIp = null, $port = null) | ||||
|     { | ||||
|         $favoriteElement = new AddFavorite($login); | ||||
|         $favoriteElement = new AddFavorite($loginOrIp, $port); | ||||
|         return $this->addElement($favoriteElement); | ||||
|     } | ||||
|  | ||||
| @@ -311,15 +313,18 @@ class ManiaCode | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Remove all ManiaCode Elements | ||||
|      * Add ManiaCode Elements | ||||
|      * | ||||
|      * @api | ||||
|      * @param Element[] $elements Elements to add | ||||
|      * @return static | ||||
|      * @deprecated use removeAllElements() instead | ||||
|      */ | ||||
|     public function removeElements() | ||||
|     public function addElements(array $elements) | ||||
|     { | ||||
|         return $this->removeAllElements(); | ||||
|         foreach ($elements as $element) { | ||||
|             $this->addElement($element); | ||||
|         } | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -334,6 +339,19 @@ class ManiaCode | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Remove all ManiaCode Elements | ||||
|      * | ||||
|      * @api | ||||
|      * @return static | ||||
|      * @deprecated Use removeAllElements() | ||||
|      * @see        ManiaCode::removeAllElements() | ||||
|      */ | ||||
|     public function removeElements() | ||||
|     { | ||||
|         return $this->removeAllElements(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Render the ManiaCode | ||||
|      * | ||||
|   | ||||
| @@ -21,7 +21,10 @@ class ManiaLink | ||||
|     /* | ||||
|      * Constants | ||||
|      */ | ||||
|     const MANIALINK_VERSION   = 3; | ||||
|     const VERSION_0           = 0; | ||||
|     const VERSION_1           = 1; | ||||
|     const VERSION_2           = 2; | ||||
|     const VERSION_3           = 3; | ||||
|     const BACKGROUND_0        = "0"; | ||||
|     const BACKGROUND_1        = "1"; | ||||
|     const BACKGROUND_STARS    = "stars"; | ||||
| @@ -36,7 +39,7 @@ class ManiaLink | ||||
|     /** | ||||
|      * @var int $version ManiaLink version | ||||
|      */ | ||||
|     protected $version = 1; | ||||
|     protected $version = 0; | ||||
|  | ||||
|     /** | ||||
|      * @var string $name ManiaLink name | ||||
| @@ -88,7 +91,7 @@ class ManiaLink | ||||
|      * @param Renderable[] $children    (optional) Children | ||||
|      * @return static | ||||
|      */ | ||||
|     public static function create($maniaLinkId = null, $version = null, $name = null, array $children = null) | ||||
|     public static function create($maniaLinkId = null, $version = ManiaLink::VERSION_1, $name = null, array $children = null) | ||||
|     { | ||||
|         return new static($maniaLinkId, $version, $name, $children); | ||||
|     } | ||||
| @@ -102,18 +105,17 @@ class ManiaLink | ||||
|      * @param string       $name        (optional) Name | ||||
|      * @param Renderable[] $children    (optional) Children | ||||
|      */ | ||||
|     public function __construct($maniaLinkId = null, $version = null, $name = null, array $children = null) | ||||
|     public function __construct($maniaLinkId = null, $version = ManiaLink::VERSION_3, $name = null, array $children = null) | ||||
|     { | ||||
|         if (is_string($version)) { | ||||
|         if (is_string($version) && (!$name || is_array($name)) && !$children) { | ||||
|             // backwards-compatibility (version has been introduced later) | ||||
|             $children = $name; | ||||
|             $name     = $version; | ||||
|             $version  = null; | ||||
|             $version  = ManiaLink::VERSION_3; | ||||
|         } | ||||
|         if ($maniaLinkId) { | ||||
|             $this->setId($maniaLinkId); | ||||
|         } | ||||
|         $this->setVersion(self::MANIALINK_VERSION); | ||||
|         if ($version) { | ||||
|             $this->setVersion($version); | ||||
|         } | ||||
| @@ -123,7 +125,6 @@ class ManiaLink | ||||
|         if ($children) { | ||||
|             $this->setChildren($children); | ||||
|         } | ||||
|         $this->createScript(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -290,7 +291,8 @@ class ManiaLink | ||||
|      * @api | ||||
|      * @param Renderable $child Child Element to add | ||||
|      * @return static | ||||
|      * @deprecated use addChild() instead | ||||
|      * @deprecated Use addChild() | ||||
|      * @see        ManiaLink::addChild() | ||||
|      */ | ||||
|     public function add(Renderable $child) | ||||
|     { | ||||
| @@ -312,6 +314,21 @@ class ManiaLink | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Add children | ||||
|      * | ||||
|      * @api | ||||
|      * @param Renderable[] $children Child Elements to add | ||||
|      * @return static | ||||
|      */ | ||||
|     public function addChildren(array $children) | ||||
|     { | ||||
|         foreach ($children as $child) { | ||||
|             $this->addChild($child); | ||||
|         } | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set children | ||||
|      * | ||||
| @@ -321,11 +338,8 @@ class ManiaLink | ||||
|      */ | ||||
|     public function setChildren(array $children) | ||||
|     { | ||||
|         $this->children = array(); | ||||
|         foreach ($children as $child) { | ||||
|             $this->addChild($child); | ||||
|         } | ||||
|         return $this; | ||||
|         return $this->removeAllChildren() | ||||
|                     ->addChildren($children); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -333,7 +347,8 @@ class ManiaLink | ||||
|      * | ||||
|      * @api | ||||
|      * @return static | ||||
|      * @deprecated use removeAllChildren() instead | ||||
|      * @deprecated Use removeAllChildren() | ||||
|      * @see        ManiaLink::removeAllChildren() | ||||
|      */ | ||||
|     public function removeChildren() | ||||
|     { | ||||
| @@ -356,10 +371,14 @@ class ManiaLink | ||||
|      * Get the Dictionary | ||||
|      * | ||||
|      * @api | ||||
|      * @param bool $createIfEmpty (optional) If the Dico should be created if it doesn't exist yet | ||||
|      * @return Dico | ||||
|      */ | ||||
|     public function getDico() | ||||
|     public function getDico($createIfEmpty = true) | ||||
|     { | ||||
|         if (!$this->dico && $createIfEmpty) { | ||||
|             $this->setDico(new Dico()); | ||||
|         } | ||||
|         return $this->dico; | ||||
|     } | ||||
|  | ||||
| @@ -382,8 +401,11 @@ class ManiaLink | ||||
|      * @api | ||||
|      * @return Stylesheet | ||||
|      */ | ||||
|     public function getStylesheet() | ||||
|     public function getStylesheet($createIfEmpty = true) | ||||
|     { | ||||
|         if (!$this->stylesheet && $createIfEmpty) { | ||||
|             return $this->createStylesheet(); | ||||
|         } | ||||
|         return $this->stylesheet; | ||||
|     } | ||||
|  | ||||
| @@ -400,14 +422,34 @@ class ManiaLink | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Create and assign a new Stylesheet if necessary | ||||
|      * | ||||
|      * @api | ||||
|      * @return Stylesheet | ||||
|      */ | ||||
|     public function createStylesheet() | ||||
|     { | ||||
|         if ($this->stylesheet) { | ||||
|             return $this->stylesheet; | ||||
|         } | ||||
|         $stylesheet = new Stylesheet(); | ||||
|         $this->setStylesheet($stylesheet); | ||||
|         return $this->stylesheet; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the Script | ||||
|      * | ||||
|      * @api | ||||
|      * @param bool $createIfEmpty (optional) Create the script if it's not set yet | ||||
|      * @return Script | ||||
|      */ | ||||
|     public function getScript() | ||||
|     public function getScript($createIfEmpty = true) | ||||
|     { | ||||
|         if (!$this->script && $createIfEmpty) { | ||||
|             return $this->createScript(); | ||||
|         } | ||||
|         return $this->script; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -64,7 +64,8 @@ class ManiaLinks | ||||
|      * @api | ||||
|      * @param ManiaLink $child Child ManiaLink | ||||
|      * @return static | ||||
|      * @deprecated use addChild() instead | ||||
|      * @deprecated Use addChild() | ||||
|      * @see        ManiaLinks::addChild() | ||||
|      */ | ||||
|     public function add(ManiaLink $child) | ||||
|     { | ||||
| @@ -86,6 +87,21 @@ class ManiaLinks | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Add child ManiaLinks | ||||
|      * | ||||
|      * @api | ||||
|      * @param ManiaLink[] $children Child ManiaLinks | ||||
|      * @return static | ||||
|      */ | ||||
|     public function addChildren(array $children) | ||||
|     { | ||||
|         foreach ($children as $child) { | ||||
|             $this->addChild($child); | ||||
|         } | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set ManiaLink children | ||||
|      * | ||||
| @@ -95,23 +111,8 @@ class ManiaLinks | ||||
|      */ | ||||
|     public function setChildren(array $children) | ||||
|     { | ||||
|         $this->children = array(); | ||||
|         foreach ($children as $child) { | ||||
|             $this->addChild($child); | ||||
|         } | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Remove all child ManiaLinks | ||||
|      * | ||||
|      * @api | ||||
|      * @return static | ||||
|      * @deprecated use removeAllChildren instead | ||||
|      */ | ||||
|     public function removeChildren() | ||||
|     { | ||||
|         return $this->removeAllChildren(); | ||||
|         return $this->removeAllChildren() | ||||
|                     ->addChildren($children); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -126,14 +127,31 @@ class ManiaLinks | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Remove all child ManiaLinks | ||||
|      * | ||||
|      * @api | ||||
|      * @return static | ||||
|      * @deprecated Use removeAllChildren() | ||||
|      * @see        ManiaLinks::removeAllChildren() | ||||
|      */ | ||||
|     public function removeChildren() | ||||
|     { | ||||
|         return $this->removeAllChildren(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the CustomUI | ||||
|      * | ||||
|      * @api | ||||
|      * @param bool $createIfEmpty (optional) If the Custom UI should be created if it doesn't exist yet | ||||
|      * @return CustomUI | ||||
|      */ | ||||
|     public function getCustomUI() | ||||
|     public function getCustomUI($createIfEmpty = true) | ||||
|     { | ||||
|         if (!$this->customUI && $createIfEmpty) { | ||||
|             $this->setCustomUI(new CustomUI()); | ||||
|         } | ||||
|         return $this->customUI; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -75,6 +75,7 @@ class ControlScript extends ScriptFeature | ||||
|     public function setControl(Control $control) | ||||
|     { | ||||
|         $control->checkId(); | ||||
|         $control->addScriptFeature($this); | ||||
|         $this->control = $control; | ||||
|         $this->updateScriptEvents(); | ||||
|         return $this; | ||||
| @@ -104,6 +105,20 @@ class ControlScript extends ScriptFeature | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Set the script text | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $text Text | ||||
|      * @return static | ||||
|      * @deprecated Use setScriptText() | ||||
|      * @see        ControlScript::setScriptText() | ||||
|      */ | ||||
|     public function setText($text) | ||||
|     { | ||||
|         return $this->setScriptText($text); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the Script Label name | ||||
|      * | ||||
| @@ -174,8 +189,8 @@ declare Control <=> Event.Control;"; | ||||
|             $scriptText .= " | ||||
| declare Control <=> Page.GetFirstChild({$controlId});"; | ||||
|         } | ||||
|         $class = $this->control->getManiaScriptClass(); | ||||
|         $name  = preg_replace('/^CMl/', '', $class, 1); | ||||
|         $class      = $this->control->getManiaScriptClass(); | ||||
|         $name       = preg_replace('/^CMl/', '', $class, 1); | ||||
|         $scriptText .= " | ||||
| declare {$name} <=> (Control as {$class}); | ||||
| "; | ||||
|   | ||||
| @@ -18,19 +18,38 @@ class Script | ||||
|      * Constants | ||||
|      */ | ||||
|     const TICKINTERVAL    = 250; | ||||
|     const VAR_ScriptStart = 'FML_ScriptStart'; | ||||
|     const VAR_LoopCounter = 'FML_LoopCounter'; | ||||
|     const VAR_LastTick    = 'FML_LastTick'; | ||||
|     const VAR_ScriptStart = "FML_ScriptStart"; | ||||
|     const VAR_LoopCounter = "FML_LoopCounter"; | ||||
|     const VAR_LastTick    = "FML_LastTick"; | ||||
|  | ||||
|     /* | ||||
|      * Protected properties | ||||
|     /** | ||||
|      * @var ScriptFeature[] $features Script Features | ||||
|      */ | ||||
|     protected $tagName = 'script'; | ||||
|     protected $features = array(); | ||||
|  | ||||
|     /** | ||||
|      * @var ScriptInclude[] $includes Script Includes | ||||
|      */ | ||||
|     protected $includes = array(); | ||||
|  | ||||
|     /** | ||||
|      * @var ScriptConstant[] $constants Script Constants | ||||
|      */ | ||||
|     protected $constants = array(); | ||||
|  | ||||
|     /** | ||||
|      * @var ScriptFunction[] $functions Script Functions | ||||
|      */ | ||||
|     protected $functions = array(); | ||||
|  | ||||
|     /** | ||||
|      * @var ScriptLabel[] $customLabels Custom Script Labels | ||||
|      */ | ||||
|     protected $customLabels = array(); | ||||
|  | ||||
|     /** | ||||
|      * @var ScriptLabel[] $genericLabels Generic Script Labels | ||||
|      */ | ||||
|     protected $genericLabels = array(); | ||||
|  | ||||
|     /** | ||||
| @@ -229,10 +248,13 @@ class Script | ||||
|     public function render(\DOMDocument $domDocument) | ||||
|     { | ||||
|         $this->loadFeatures($this->features); | ||||
|         $scriptXml     = $domDocument->createElement($this->tagName); | ||||
|         $scriptText    = $this->buildScriptText(); | ||||
|  | ||||
|         $scriptXml  = $domDocument->createElement("script"); | ||||
|         $scriptText = $this->buildScriptText(); | ||||
|  | ||||
|         $scriptComment = $domDocument->createComment($scriptText); | ||||
|         $scriptXml->appendChild($scriptComment); | ||||
|  | ||||
|         return $scriptXml; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -12,6 +12,11 @@ namespace FML\Stylesheet; | ||||
| class Stylesheet | ||||
| { | ||||
|  | ||||
|     /** | ||||
|      * @var Style[] $styles Styles | ||||
|      */ | ||||
|     protected $styles = array(); | ||||
|  | ||||
|     /** | ||||
|      * @var Style3d[] $styles3d 3d Styles | ||||
|      */ | ||||
| @@ -33,6 +38,44 @@ class Stylesheet | ||||
|         return new static(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the Styles | ||||
|      * | ||||
|      * @api | ||||
|      * @return Style[] | ||||
|      */ | ||||
|     public function getStyles() | ||||
|     { | ||||
|         return $this->styles; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Add a new Style | ||||
|      * | ||||
|      * @api | ||||
|      * @param Style $style The Style to be added | ||||
|      * @return static | ||||
|      */ | ||||
|     public function addStyle(Style $style) | ||||
|     { | ||||
|         if (!in_array($style, $this->styles, true)) { | ||||
|             array_push($this->styles, $style); | ||||
|         } | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Remove all Styles | ||||
|      * | ||||
|      * @api | ||||
|      * @return static | ||||
|      */ | ||||
|     public function removeAllStyles() | ||||
|     { | ||||
|         $this->styles = array(); | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the Styles3d | ||||
|      * | ||||
| @@ -71,14 +114,32 @@ class Stylesheet | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Remove all Style3ds | ||||
|      * | ||||
|      * @api | ||||
|      * @return static | ||||
|      * @deprecated Use removeAllStyles3d() | ||||
|      * @see        Stylesheet::removeAllStyles3d() | ||||
|      */ | ||||
|     public function removeStyles() | ||||
|     { | ||||
|         return $this->removeAllStyles() | ||||
|                     ->removeAllStyles3d(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the Mood | ||||
|      * | ||||
|      * @api | ||||
|      * @param bool $createIfEmpty (optional) If the Mood should be created if it doesn't exist yet | ||||
|      * @return Mood | ||||
|      */ | ||||
|     public function getMood() | ||||
|     public function getMood($createIfEmpty = true) | ||||
|     { | ||||
|         if (!$this->mood && $createIfEmpty) { | ||||
|             $this->createMood(); | ||||
|         } | ||||
|         return $this->mood; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -29,4 +29,21 @@ interface BackgroundColorable | ||||
|      */ | ||||
|     public function setBackgroundColor($backgroundColor); | ||||
|  | ||||
|     /** | ||||
|      * Get the focus background color | ||||
|      * | ||||
|      * @api | ||||
|      * @return string | ||||
|      */ | ||||
|     public function getFocusBackgroundColor(); | ||||
|  | ||||
|     /** | ||||
|      * Set the focus background color | ||||
|      * | ||||
|      * @api | ||||
|      * @param string $focusBackgroundColor Focus background color | ||||
|      * @return static | ||||
|      */ | ||||
|     public function setFocusBackgroundColor($focusBackgroundColor); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
| namespace FML\Types; | ||||
|  | ||||
| use FML\Elements\Format; | ||||
| use FML\Stylesheet\Style; | ||||
|  | ||||
| /** | ||||
|  * Interface for Element being able to contain other Controls | ||||
| @@ -31,6 +32,17 @@ interface Container | ||||
|      */ | ||||
|     public function addChild(Renderable $child); | ||||
|  | ||||
|     /** | ||||
|      * Add a new child | ||||
|      * | ||||
|      * @api | ||||
|      * @param Renderable $child Child Control to add | ||||
|      * @return static | ||||
|      * @deprecated Use addChild() | ||||
|      * @see        Container::addChild() | ||||
|      */ | ||||
|     public function add(Renderable $child); | ||||
|  | ||||
|     /** | ||||
|      * Add new children | ||||
|      * | ||||
| @@ -48,13 +60,26 @@ interface Container | ||||
|      */ | ||||
|     public function removeAllChildren(); | ||||
|  | ||||
|     /** | ||||
|      * Remove all children | ||||
|      * | ||||
|      * @api | ||||
|      * @return static | ||||
|      * @deprecated Use removeAllChildren() | ||||
|      * @see        Container::removeAllChildren() | ||||
|      */ | ||||
|     public function removeChildren(); | ||||
|  | ||||
|     /** | ||||
|      * Get the Format | ||||
|      * | ||||
|      * @api | ||||
|      * @param bool $createIfEmpty If the format should be created if it doesn't exist yet | ||||
|      * @return Format | ||||
|      * @deprecated Use Style | ||||
|      * @see        Style | ||||
|      */ | ||||
|     public function getFormat(); | ||||
|     public function getFormat($createIfEmpty = true); | ||||
|  | ||||
|     /** | ||||
|      * Set the Format | ||||
| @@ -62,6 +87,8 @@ interface Container | ||||
|      * @api | ||||
|      * @param Format $format New Format | ||||
|      * @return static | ||||
|      * @deprecated Use Style | ||||
|      * @see        Style | ||||
|      */ | ||||
|     public function setFormat(Format $format = null); | ||||
|  | ||||
|   | ||||
| @@ -18,8 +18,9 @@ interface NewLineable | ||||
|      * Get auto new line | ||||
|      * | ||||
|      * @api | ||||
|      * @deprecated | ||||
|      * @return bool | ||||
|      * @deprecated Use MultiLineable::getAutoNewLine() | ||||
|      * @see        MultiLineable::getAutoNewLine() | ||||
|      */ | ||||
|     public function getAutoNewLine(); | ||||
|  | ||||
| @@ -27,9 +28,10 @@ interface NewLineable | ||||
|      * Set auto new line | ||||
|      * | ||||
|      * @api | ||||
|      * @deprecated | ||||
|      * @param bool $autoNewLine If the Element should insert new lines automatically | ||||
|      * @return static | ||||
|      * @deprecated Use MultiLineable::setAutoNewLine() | ||||
|      * @see        MultiLineable::setAutoNewLine() | ||||
|      */ | ||||
|     public function setAutoNewLine($autoNewLine); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user