Huge FML Update
This commit is contained in:
parent
34be67569f
commit
5447588749
@ -3,16 +3,17 @@
|
||||
namespace FML\Controls;
|
||||
|
||||
/**
|
||||
* Class representing audio (CMlMediaPlayer)
|
||||
* Class representing Audio (CMlMediaPlayer)
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class Audio extends Control implements Playable, Scriptable {
|
||||
|
||||
/**
|
||||
* Construct a new audio control
|
||||
* Construct a new Audio Control
|
||||
*
|
||||
* @param string $id
|
||||
* Control Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
|
@ -21,7 +21,7 @@ abstract class Control implements Renderable {
|
||||
const LEFT = 'left';
|
||||
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $tagName = 'control';
|
||||
protected $id = '';
|
||||
@ -37,9 +37,9 @@ abstract class Control implements Renderable {
|
||||
protected $classes = array();
|
||||
|
||||
/**
|
||||
* Construct a new control
|
||||
* Construct a new Control
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $id Control Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
if ($id !== null) {
|
||||
@ -48,7 +48,7 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get control id
|
||||
* Get Control Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -57,9 +57,9 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set control id
|
||||
* Set Control Id
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $id Control Id
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setId($id) {
|
||||
@ -68,22 +68,35 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign an unique id if necessary
|
||||
* Check Id for dangerous Characters and assign an unique Id if necessary
|
||||
*
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function assignId() {
|
||||
if ($this->getId()) {
|
||||
public function checkId() {
|
||||
if (!$this->getId()) {
|
||||
$this->setId(uniqid());
|
||||
return $this;
|
||||
}
|
||||
$this->setId(uniqid());
|
||||
$dangerousCharacters = array(' ', ' ', '.', '|', '-', PHP_EOL);
|
||||
$idCharacters = str_split($this->getId());
|
||||
$danger = false;
|
||||
foreach ($idCharacters as $character) {
|
||||
if (!in_array($character, $dangerousCharacters)) continue;
|
||||
$danger = true;
|
||||
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);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set x position
|
||||
* Set X Position
|
||||
*
|
||||
* @param float $x
|
||||
* @param float $x Horizontal Position
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setX($x) {
|
||||
@ -92,9 +105,9 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set y position
|
||||
* Set Y Position
|
||||
*
|
||||
* @param float $y
|
||||
* @param float $y Vertical Position
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setY($y) {
|
||||
@ -103,9 +116,9 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set z position
|
||||
* Set Z Position
|
||||
*
|
||||
* @param float $z
|
||||
* @param float $z Depth
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setZ($z) {
|
||||
@ -114,11 +127,11 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set position
|
||||
* Set Control Position
|
||||
*
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $z
|
||||
* @param float $x Horizontal Position
|
||||
* @param float $y Vertical Position
|
||||
* @param float $z Depth
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setPosition($x, $y, $z = null) {
|
||||
@ -131,9 +144,9 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set width
|
||||
* Set Control Width
|
||||
*
|
||||
* @param float $width
|
||||
* @param float $width Control Width
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setWidth($width) {
|
||||
@ -142,9 +155,9 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set height
|
||||
* Set Control Height
|
||||
*
|
||||
* @param float $height
|
||||
* @param float $height Control Height
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setHeight($height) {
|
||||
@ -153,10 +166,10 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set size
|
||||
* Set Control Size
|
||||
*
|
||||
* @param float $width
|
||||
* @param float $height
|
||||
* @param float $width Control Width
|
||||
* @param float $height Control Height
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setSize($width, $height) {
|
||||
@ -166,9 +179,9 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set horizontal alignment
|
||||
* Set Horizontal Alignment
|
||||
*
|
||||
* @param string $hAlign
|
||||
* @param string $hAlign Horizontal Alignment
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setHAlign($hAlign) {
|
||||
@ -177,9 +190,9 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set vertical alignment
|
||||
* Set Vertical Alignment
|
||||
*
|
||||
* @param string $vAlign
|
||||
* @param string $vAlign Vertical Alignment
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setVAlign($vAlign) {
|
||||
@ -188,10 +201,10 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set horizontal and vertical alignment
|
||||
* Set Horizontal and Vertical Alignment
|
||||
*
|
||||
* @param string $hAlign
|
||||
* @param string $vAlign
|
||||
* @param string $hAlign Horizontal Alignment
|
||||
* @param string $vAlign Vertical Alignment
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setAlign($hAlign, $vAlign) {
|
||||
@ -201,9 +214,9 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set scale
|
||||
* Set Control Scale
|
||||
*
|
||||
* @param float $scale
|
||||
* @param float $scale Control Scale
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setScale($scale) {
|
||||
@ -212,9 +225,9 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set visible
|
||||
* Set Visibility
|
||||
*
|
||||
* @param bool $visible
|
||||
* @param bool $visible If Control should be visible
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function setVisible($visible) {
|
||||
@ -223,13 +236,15 @@ abstract class Control implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add class name
|
||||
* Add new Class Name
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $class Class Name
|
||||
* @return \FML\Controls\Control
|
||||
*/
|
||||
public function addClass($class) {
|
||||
if (!in_array($class, $this->classes)) {
|
||||
array_push($this->classes, $class);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -248,14 +263,12 @@ abstract class Control implements Renderable {
|
||||
if ($this->width >= 0. || $this->height >= 0.) {
|
||||
$xml->setAttribute('sizen', "{$this->width} {$this->height}");
|
||||
}
|
||||
if (get_class($this) !== Frame::getClass()) {
|
||||
if ($this->hAlign) {
|
||||
$xml->setAttribute('halign', $this->hAlign);
|
||||
}
|
||||
if ($this->vAlign) {
|
||||
$xml->setAttribute('valign', $this->vAlign);
|
||||
}
|
||||
}
|
||||
if ($this->scale !== 1.) {
|
||||
$xml->setAttribute('scale', $this->scale);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ use FML\Types\TextFormatable;
|
||||
*/
|
||||
class Entry extends Control implements NewLineable, Scriptable, Styleable, TextFormatable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $name = '';
|
||||
protected $default = null;
|
||||
@ -27,7 +27,7 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
protected $areaFocusColor = '';
|
||||
|
||||
/**
|
||||
* Construct a new entry control
|
||||
* Construct a new Entry Control
|
||||
*
|
||||
* @param string $id
|
||||
*/
|
||||
@ -37,9 +37,10 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
* Set Entry Name
|
||||
*
|
||||
* @param string $name
|
||||
* Entry Name
|
||||
* @return \FML\Controls\Entry
|
||||
*/
|
||||
public function setName($name) {
|
||||
@ -48,9 +49,10 @@ class Entry extends Control implements NewLineable, Scriptable, Styleable, TextF
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default
|
||||
* Set Default Value
|
||||
*
|
||||
* @param string $default
|
||||
* Default Value
|
||||
* @return \FML\Controls\Entry
|
||||
*/
|
||||
public function setDefault($default) {
|
||||
|
@ -9,14 +9,15 @@ namespace FML\Controls;
|
||||
*/
|
||||
class FileEntry extends Entry {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $folder = '';
|
||||
|
||||
/**
|
||||
* Construct a new FileEntry control
|
||||
* Construct a new FileEntry Control
|
||||
*
|
||||
* @param string $id
|
||||
* Control Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
@ -24,9 +25,10 @@ class FileEntry extends Entry {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set folder
|
||||
* Set Folder
|
||||
*
|
||||
* @param string $folder
|
||||
* Base Folder
|
||||
* @return \FML\Controls\FileEntry
|
||||
*/
|
||||
public function setFolder($folder) {
|
||||
|
@ -12,14 +12,15 @@ use FML\Types\Renderable;
|
||||
*/
|
||||
class Frame extends Control implements Container {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $children = array();
|
||||
|
||||
/**
|
||||
* Construct a new frame control
|
||||
* Construct a new Frame Control
|
||||
*
|
||||
* @param string $id
|
||||
* Control Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
@ -58,13 +59,4 @@ class Frame extends Control implements Container {
|
||||
}
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return class name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getClass() {
|
||||
return __CLASS__;
|
||||
}
|
||||
}
|
||||
|
@ -5,21 +5,22 @@ namespace FML\Controls;
|
||||
use FML\Types\Scriptable;
|
||||
|
||||
/**
|
||||
* Class representing frame3d elements (CMlFrame)
|
||||
* Class representing Frame3d Elements (CMlFrame)
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class Frame3d extends Frame implements Scriptable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $style3d = '';
|
||||
protected $scriptEvents = 0;
|
||||
|
||||
/**
|
||||
* Construct a new frame3d control
|
||||
* Construct a new Frame3d Control
|
||||
*
|
||||
* @param string $id
|
||||
* Control Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
@ -30,6 +31,7 @@ class Frame3d extends Frame implements Scriptable {
|
||||
* Set style3d
|
||||
*
|
||||
* @param string $style3d
|
||||
* 3D Style
|
||||
* @return \FML\Controls\Frame3d
|
||||
*/
|
||||
public function setStyle3d($style3d) {
|
||||
|
@ -11,7 +11,7 @@ use FML\Types\Styleable;
|
||||
*/
|
||||
class Gauge extends Control implements Styleable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $ratio = 1.;
|
||||
protected $grading = 1.;
|
||||
@ -24,9 +24,10 @@ class Gauge extends Control implements Styleable {
|
||||
protected $style = '';
|
||||
|
||||
/**
|
||||
* Construct a new gauge control
|
||||
* Construct a new Gauge Control
|
||||
*
|
||||
* @param string $id
|
||||
* Control Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
@ -34,9 +35,10 @@ class Gauge extends Control implements Styleable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ratio
|
||||
* Set Ratio
|
||||
*
|
||||
* @param float $ratio
|
||||
* Ratio Value
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setRatio($ratio) {
|
||||
@ -45,9 +47,10 @@ class Gauge extends Control implements Styleable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set grading
|
||||
* Set Grading
|
||||
*
|
||||
* @param float $grading
|
||||
* Grading Value
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setGrading($grading) {
|
||||
@ -56,9 +59,10 @@ class Gauge extends Control implements Styleable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set color
|
||||
* Set Color
|
||||
*
|
||||
* @param string $color
|
||||
* Gauge Color
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setColor($color) {
|
||||
@ -67,9 +71,10 @@ class Gauge extends Control implements Styleable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set rotation
|
||||
* Set Rotation
|
||||
*
|
||||
* @param float $rotation
|
||||
* Gauge Rotation
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setRotation($rotation) {
|
||||
@ -78,9 +83,10 @@ class Gauge extends Control implements Styleable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set centered
|
||||
* Set Centered
|
||||
*
|
||||
* @param bool $centered
|
||||
* If Gauge is centered
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setCentered($centered) {
|
||||
@ -89,9 +95,10 @@ class Gauge extends Control implements Styleable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set clan
|
||||
* Set Clan
|
||||
*
|
||||
* @param int $clan
|
||||
* Clan number
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setClan($clan) {
|
||||
@ -100,9 +107,10 @@ class Gauge extends Control implements Styleable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set draw background
|
||||
* Set Draw Background
|
||||
*
|
||||
* @param bool $drawBg
|
||||
* If Gauge Background should be drawn
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setDrawBg($drawBg) {
|
||||
@ -111,9 +119,10 @@ class Gauge extends Control implements Styleable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set draw block background
|
||||
* Set Draw Block Background
|
||||
*
|
||||
* @param bool $drawBlockBg
|
||||
* If Gauge Block Background should be drawn
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setDrawBlockBg($drawBlockBg) {
|
||||
@ -124,6 +133,7 @@ class Gauge extends Control implements Styleable {
|
||||
/**
|
||||
*
|
||||
* @see \FML\Types\Styleable::setStyle()
|
||||
* @return \FML\Controls\Gauge
|
||||
*/
|
||||
public function setStyle($style) {
|
||||
$this->style = $style;
|
||||
|
@ -16,7 +16,7 @@ use FML\Types\TextFormatable;
|
||||
*/
|
||||
class Label extends Control implements Actionable, Linkable, NewLineable, Scriptable, Styleable, TextFormatable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $text = '';
|
||||
protected $textPrefix = '';
|
||||
@ -35,9 +35,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
|
||||
protected $areaFocusColor = '';
|
||||
|
||||
/**
|
||||
* Construct label control
|
||||
* Construct a new Label Control
|
||||
*
|
||||
* @param string $id
|
||||
* Control Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
@ -46,9 +47,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text
|
||||
* Set Text
|
||||
*
|
||||
* @param string $text
|
||||
* Text Value
|
||||
* @return \FML\Controls\Label
|
||||
*/
|
||||
public function setText($text) {
|
||||
@ -57,9 +59,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text prefix
|
||||
* Set Text Prefix
|
||||
*
|
||||
* @param string $textPrefix
|
||||
* Text Pefix
|
||||
* @return \FML\Controls\Label
|
||||
*/
|
||||
public function setTextPrefix($textPrefix) {
|
||||
@ -68,9 +71,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text emboss
|
||||
* Set Text Emboss
|
||||
*
|
||||
* @param bool $textEmboss
|
||||
* If Text should be embossed
|
||||
* @return \FML\Controls\Label
|
||||
*/
|
||||
public function setTextEmboss($textEmboss) {
|
||||
@ -79,9 +83,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
|
||||
}
|
||||
|
||||
/**
|
||||
* Set translate
|
||||
* Set Translate
|
||||
*
|
||||
* @param bool $translate
|
||||
* If Text should be translated
|
||||
* @return \FML\Controls\Label
|
||||
*/
|
||||
public function setTranslate($translate) {
|
||||
@ -90,9 +95,10 @@ class Label extends Control implements Actionable, Linkable, NewLineable, Script
|
||||
}
|
||||
|
||||
/**
|
||||
* Set max lines
|
||||
* Set Max Lines Count
|
||||
*
|
||||
* @param int $maxLines
|
||||
* Max Lines Count
|
||||
* @return \FML\Controls\Label
|
||||
*/
|
||||
public function setMaxLines($maxLines) {
|
||||
|
@ -16,7 +16,7 @@ use FML\Types\SubStyleable;
|
||||
*/
|
||||
class Quad extends Control implements Actionable, BgColorable, Linkable, Scriptable, Styleable, SubStyleable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $image = '';
|
||||
protected $imageFocus = '';
|
||||
@ -31,9 +31,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
protected $subStyle = '';
|
||||
|
||||
/**
|
||||
* Construct a new quad control
|
||||
* Construct a new Quad Control
|
||||
*
|
||||
* @param string $id
|
||||
* Control Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
@ -42,9 +43,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
}
|
||||
|
||||
/**
|
||||
* Set image
|
||||
* Set Image Url
|
||||
*
|
||||
* @param string $image
|
||||
* Image Url
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setImage($image) {
|
||||
@ -53,9 +55,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
}
|
||||
|
||||
/**
|
||||
* Set focus image
|
||||
* Set Focus Image Url
|
||||
*
|
||||
* @param string $imageFocus
|
||||
* Focus Image Url
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setImageFocus($imageFocus) {
|
||||
@ -64,9 +67,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
}
|
||||
|
||||
/**
|
||||
* Set colorize
|
||||
* Set Colorization
|
||||
*
|
||||
* @param string $colorize
|
||||
* Colorize Value
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setColorize($colorize) {
|
||||
@ -75,9 +79,10 @@ class Quad extends Control implements Actionable, BgColorable, Linkable, Scripta
|
||||
}
|
||||
|
||||
/**
|
||||
* Set modulize color
|
||||
* Set Modulization
|
||||
*
|
||||
* @param string $modulizeColor
|
||||
* Modulize Value
|
||||
* @return \FML\Controls\Quad
|
||||
*/
|
||||
public function setModulizeColor($modulizeColor) {
|
||||
|
@ -20,10 +20,11 @@ class Quad_321Go extends Quad {
|
||||
const SUBSTYLE_Go = 'Go!';
|
||||
|
||||
/**
|
||||
* Construct 321Go quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -43,10 +43,11 @@ class Quad_BgRaceScore2 extends Quad {
|
||||
const SUBSTYLE_Warmup = 'Warmup';
|
||||
|
||||
/**
|
||||
* Construct BgRaceScore2 quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -80,10 +80,11 @@ class Quad_Bgs1 extends Quad {
|
||||
const SUBSTYLE_Shadow = 'Shadow';
|
||||
|
||||
/**
|
||||
* Construct Bgs1 quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -80,10 +80,11 @@ class Quad_Bgs1InRace extends Quad {
|
||||
const SUBSTYLE_Shadow = 'Shadow';
|
||||
|
||||
/**
|
||||
* Construct Bgs1InRace quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,11 @@ class Quad_BgsChallengeMedals extends Quad {
|
||||
const SUBSTYLE_BgSilver = 'BgSilver';
|
||||
|
||||
/**
|
||||
* Construct BgsChallengeMedals quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -30,10 +30,11 @@ class Quad_BgsPlayerCard extends Quad {
|
||||
const SUBSTYLE_ProgressBar = 'ProgressBar';
|
||||
|
||||
/**
|
||||
* Construct BgsPlayerCard quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,11 @@ class Quad_Copilot extends Quad {
|
||||
const SUBSTYLE_UpWrong = 'UpWrong';
|
||||
|
||||
/**
|
||||
* Construct Copilot quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,11 @@ class Quad_Emblems extends Quad {
|
||||
const SUBSTYLE_2 = '#2';
|
||||
|
||||
/**
|
||||
* Construct Emblems quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,11 @@ class Quad_EnergyBar extends Quad {
|
||||
const SUBSTYLE_HeaderGaugeRight = 'HeaderGaugeRight';
|
||||
|
||||
/**
|
||||
* Construct EnergyBar quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,11 @@ class Quad_Hud3dEchelons extends Quad {
|
||||
const SUBSTYLE_EchelonSilver3 = 'EchelonSilver3';
|
||||
|
||||
/**
|
||||
* Construct Hud3dEchelons quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ class Quad_Icons128x128_1 extends Quad {
|
||||
/**
|
||||
* Construct Icons128x128_1 quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -80,10 +80,11 @@ class Quad_Icons128x128_Blink extends Quad {
|
||||
const SUBSTYLE_Vehicles = 'Vehicles';
|
||||
|
||||
/**
|
||||
* Construct Icons128x128_Blink quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -41,10 +41,11 @@ class Quad_Icons128x32_1 extends Quad {
|
||||
const SUBSTYLE_Windowed = 'Windowed';
|
||||
|
||||
/**
|
||||
* Construct Icons128x32_1 quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -101,10 +101,11 @@ class Quad_Icons64x64_1 extends Quad {
|
||||
const SUBSTYLE_YellowLow = 'YellowLow';
|
||||
|
||||
/**
|
||||
* Construct Icons64x64_1 quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,11 @@ class Quad_Icons64x64_2 extends Quad {
|
||||
const SUBSTYLE_UnknownHit = 'UnknownHit';
|
||||
|
||||
/**
|
||||
* Construct Icons64x64_2 quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,11 @@ class Quad_ManiaPlanetLogos extends Quad {
|
||||
const SUBSTYLE_ManiaPlanetLogoWhiteSmall = 'ManiaPlanetLogoWhiteSmall';
|
||||
|
||||
/**
|
||||
* Construct ManiaPlanetLogos quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,11 @@ class Quad_ManiaplanetSystem extends Quad {
|
||||
const SUBSTYLE_Statistics = 'Statistics';
|
||||
|
||||
/**
|
||||
* Construct ManiaplanetSystem quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,11 @@ class Quad_MedalsBig extends Quad {
|
||||
const SUBSTYLE_MedalSlot = 'MedalSlot';
|
||||
|
||||
/**
|
||||
* Construct MedalsBig quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,11 @@ class Quad_TitleLogos extends Quad {
|
||||
const SUBSTYLE_Title = 'Title';
|
||||
|
||||
/**
|
||||
* Construct TitleLogos quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -70,10 +70,11 @@ class Quad_UIConstruction_Buttons extends Quad {
|
||||
const SUBSTYLE_Validate_Step3 = 'Validate_Step3';
|
||||
|
||||
/**
|
||||
* Construct UIConstruction_Buttons quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -37,10 +37,11 @@ class Quad_UiSMSpectatorScoreBig extends Quad {
|
||||
CONST SUBSTYLE_UIRange2Bg = 'UIRange2Bg';
|
||||
|
||||
/**
|
||||
* Construct UiSMSpectatorScoreBig quad
|
||||
*
|
||||
* @see \FML\Controls\Quad
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
$this->setStyle(self::STYLE);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,10 @@ namespace FML\Controls;
|
||||
class Video extends Control implements Playable, Scriptable {
|
||||
|
||||
/**
|
||||
* Construct a new video control
|
||||
* Construct a new Video Control
|
||||
*
|
||||
* @param string $id
|
||||
* Control Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
parent::__construct($id);
|
||||
|
@ -1,18 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Elements;
|
||||
|
||||
use FML\Types\Renderable;
|
||||
namespace FML;
|
||||
|
||||
/**
|
||||
* Class representing the Custom_UI
|
||||
* Class representing a Custom_UI
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class CustomUI implements Renderable {
|
||||
class CustomUI {
|
||||
|
||||
/**
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $encoding = 'utf-8';
|
||||
protected $tagName = 'custom_ui';
|
||||
protected $noticeVisible = null;
|
||||
protected $challengeInfoVisible = null;
|
||||
@ -23,11 +23,22 @@ class CustomUI implements Renderable {
|
||||
protected $scoretableVisible = null;
|
||||
protected $globalVisible = null;
|
||||
|
||||
/**
|
||||
* Set XML Encoding
|
||||
*
|
||||
* @param string $encoding
|
||||
* @return \FML\CustomUI
|
||||
*/
|
||||
public function setXMLEncoding($encoding) {
|
||||
$this->encoding = $encoding;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Showing of Notices
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
* @return \FML\CustomUI
|
||||
*/
|
||||
public function setNoticeVisible($visible) {
|
||||
$this->noticeVisible = $visible;
|
||||
@ -38,7 +49,7 @@ class CustomUI implements Renderable {
|
||||
* Set Showing of the Challenge Info
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
* @return \FML\CustomUI
|
||||
*/
|
||||
public function setChallengeInfoVisible($visible) {
|
||||
$this->challengeInfoVisible = $visible;
|
||||
@ -49,7 +60,7 @@ class CustomUI implements Renderable {
|
||||
* Set Showing of the Net Infos
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
* @return \FML\CustomUI
|
||||
*/
|
||||
public function setNetInfosVisible($visible) {
|
||||
$this->netInfosVisible = $visible;
|
||||
@ -60,7 +71,7 @@ class CustomUI implements Renderable {
|
||||
* Set Showing of the Chat
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
* @return \FML\CustomUI
|
||||
*/
|
||||
public function setChatVisible($visible) {
|
||||
$this->chatVisible = $visible;
|
||||
@ -71,7 +82,7 @@ class CustomUI implements Renderable {
|
||||
* Set Showing of the Checkpoint List
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
* @return \FML\CustomUI
|
||||
*/
|
||||
public function setCheckpointListVisible($visible) {
|
||||
$this->checkpointListVisible = $visible;
|
||||
@ -82,7 +93,7 @@ class CustomUI implements Renderable {
|
||||
* Set Showing of Round Scores
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
* @return \FML\CustomUI
|
||||
*/
|
||||
public function setRoundScoresVisible($visible) {
|
||||
$this->roundScoresVisible = $visible;
|
||||
@ -93,7 +104,7 @@ class CustomUI implements Renderable {
|
||||
* Set Showing of the Scoretable
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
* @return \FML\CustomUI
|
||||
*/
|
||||
public function setScoretableVisible($visible) {
|
||||
$this->scoretableVisible = $visible;
|
||||
@ -104,7 +115,7 @@ class CustomUI implements Renderable {
|
||||
* Set Global Showing
|
||||
*
|
||||
* @param bool $visible
|
||||
* @return \FML\Elements\CustomUI
|
||||
* @return \FML\CustomUI
|
||||
*/
|
||||
public function setGlobalVisible($visible) {
|
||||
$this->globalVisible = $visible;
|
||||
@ -112,19 +123,42 @@ class CustomUI implements Renderable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the XML Document
|
||||
*
|
||||
* @see \FML\Renderable::render()
|
||||
* @param \DOMDocument $domDocument
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
public function render($domDocument = null) {
|
||||
$isChild = false;
|
||||
if ($domDocument) {
|
||||
$isChild = true;
|
||||
}
|
||||
if (!$isChild) {
|
||||
$domDocument = new \DOMDocument('1.0', $this->encoding);
|
||||
}
|
||||
$xmlElement = $domDocument->createElement($this->tagName);
|
||||
$settings = $this->getSettings();
|
||||
$xml = $domDocument->createElement($this->tagName);
|
||||
foreach ($settings as $setting => $value) {
|
||||
if ($value === null) continue;
|
||||
$xmlElement = $domDocument->createElement($setting);
|
||||
$xmlElement->setAttribute('visible', ($value ? 'true' : 'false'));
|
||||
$xml->appendChild($xmlElement);
|
||||
$xmlSubElement = $domDocument->createElement($setting);
|
||||
$xmlSubElement->setAttribute('visible', ($value ? 1 : 0));
|
||||
$xmlElement->appendChild($xmlSubElement);
|
||||
}
|
||||
return $xml;
|
||||
if ($isChild) {
|
||||
return $xmlElement;
|
||||
}
|
||||
return $domDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get String Representation
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
$domDocument = $this->render();
|
||||
$xmlText = $domDocument->saveXML();
|
||||
return $xmlText;
|
||||
}
|
||||
|
||||
/**
|
@ -9,7 +9,7 @@ namespace FML\Elements;
|
||||
*/
|
||||
class Format implements BgColorable, Renderable, Styleable, TextFormatable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $tagName = 'format';
|
||||
|
||||
|
@ -9,15 +9,16 @@ namespace FML\Elements;
|
||||
*/
|
||||
class Including implements Renderable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $url = '';
|
||||
protected $tagName = 'include';
|
||||
|
||||
/**
|
||||
* Set url
|
||||
* Set Url
|
||||
*
|
||||
* @param string $url
|
||||
* Include Url
|
||||
*/
|
||||
public function setUrl($url) {
|
||||
$this->url = $url;
|
||||
@ -29,7 +30,9 @@ class Including implements Renderable {
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$xml = $domDocument->createElement($this->tagName);
|
||||
if ($this->url) {
|
||||
$xml->setAttribute('url', $this->url);
|
||||
}
|
||||
return $xml;
|
||||
}
|
||||
}
|
||||
|
@ -9,15 +9,16 @@ namespace FML\Elements;
|
||||
*/
|
||||
class Music implements Renderable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $data = '';
|
||||
protected $tagName = 'music';
|
||||
|
||||
/**
|
||||
* Set data
|
||||
* Set Data Url
|
||||
*
|
||||
* @param string $data
|
||||
* Media Url
|
||||
* @return \FML\Elements\Music
|
||||
*/
|
||||
public function setData($data) {
|
||||
|
@ -11,13 +11,13 @@ use FML\Types\Renderable;
|
||||
*/
|
||||
class SimpleScript implements Renderable {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $tagName = 'script';
|
||||
protected $text = '';
|
||||
|
||||
/**
|
||||
* Set script text
|
||||
* Set Script Text
|
||||
*
|
||||
* @param string $text
|
||||
* @return \FML\Script\Script
|
||||
|
@ -7,13 +7,13 @@ use FML\Types\Renderable;
|
||||
use FML\Script\Script;
|
||||
|
||||
/**
|
||||
* Class representing a manialink
|
||||
* Class representing a Manialink
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class ManiaLink implements Container {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $encoding = 'utf-8';
|
||||
protected $tagName = 'manialink';
|
||||
@ -26,7 +26,10 @@ class ManiaLink implements Container {
|
||||
protected $script = null;
|
||||
|
||||
/**
|
||||
* Construct a new manialink
|
||||
* Construct a new Manialink
|
||||
*
|
||||
* @param string $id
|
||||
* Manialink Id
|
||||
*/
|
||||
public function __construct($id = null) {
|
||||
if ($id !== null) {
|
||||
@ -35,9 +38,10 @@ class ManiaLink implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set xml encoding
|
||||
* Set XML Encoding
|
||||
*
|
||||
* @param string $encoding
|
||||
* XML Encoding
|
||||
* @return \FML\ManiaLink
|
||||
*/
|
||||
public function setXmlEncoding($encoding) {
|
||||
@ -46,9 +50,10 @@ class ManiaLink implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set id
|
||||
* Set Manialink Id
|
||||
*
|
||||
* @param string $id
|
||||
* Manialink Id
|
||||
* @return \FML\ManiaLink
|
||||
*/
|
||||
public function setId($id) {
|
||||
@ -57,9 +62,10 @@ class ManiaLink implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set background
|
||||
* Set Background
|
||||
*
|
||||
* @param string $background
|
||||
* Background Value
|
||||
* @return \FML\ManiaLink
|
||||
*/
|
||||
public function setBackground($background) {
|
||||
@ -68,9 +74,10 @@ class ManiaLink implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set navigable3d
|
||||
* Set Navigable3d
|
||||
*
|
||||
* @param bool $navigable3d
|
||||
* If the manialink is 3d navigable
|
||||
* @return \FML\ManiaLink
|
||||
*/
|
||||
public function setNavigable3d($navigable3d) {
|
||||
@ -79,9 +86,10 @@ class ManiaLink implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set timeout
|
||||
* Set Timeout
|
||||
*
|
||||
* @param int $timeout
|
||||
* Timeout Duration
|
||||
* @return \FML\ManiaLink
|
||||
*/
|
||||
public function setTimeout($timeout) {
|
||||
@ -121,7 +129,7 @@ class ManiaLink implements Container {
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the xml document
|
||||
* Render the XML Document
|
||||
*
|
||||
* @param bool $echo
|
||||
* If the xml should be echoed and the content-type header should be set
|
||||
@ -173,4 +181,15 @@ class ManiaLink implements Container {
|
||||
}
|
||||
return $domDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get String Representation
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
$domDocument = $this->render();
|
||||
$xmlText = $domDocument->saveXML();
|
||||
return $xmlText;
|
||||
}
|
||||
}
|
||||
|
@ -9,16 +9,17 @@ namespace FML;
|
||||
*/
|
||||
class ManiaLinks {
|
||||
/**
|
||||
* Protected properties
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $encoding = 'utf-8';
|
||||
protected $tagName = 'manialinks';
|
||||
protected $children = array();
|
||||
|
||||
/**
|
||||
* Set xml encoding
|
||||
* Set XML Encoding
|
||||
*
|
||||
* @param string $encoding
|
||||
* XML Encoding
|
||||
* @return \FML\ManiaLinks
|
||||
*/
|
||||
public function setXmlEncoding($encoding) {
|
||||
@ -27,18 +28,21 @@ class ManiaLinks {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a child manialink
|
||||
* Add a Child Manialink
|
||||
*
|
||||
* @param ManiaLink $child
|
||||
* Child Manialink
|
||||
* @return \FML\ManiaLinks
|
||||
*/
|
||||
public function add(ManiaLink $child) {
|
||||
if (!in_array($child, $this->children)) {
|
||||
array_push($this->children, $child);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all child manialinks
|
||||
* Remove all Child Manialinks
|
||||
*
|
||||
* @return \FML\ManiaLinks
|
||||
*/
|
||||
@ -48,7 +52,7 @@ class ManiaLinks {
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the xml document
|
||||
* Render the XML Document
|
||||
*
|
||||
* @param bool $echo
|
||||
* If the xml should be echoed and the content-type header should be set
|
||||
|
23
application/core/FML/Script/Builder.php
Normal file
23
application/core/FML/Script/Builder.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script;
|
||||
|
||||
/**
|
||||
* Builder Class offering Methods to build ManiaScript
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
abstract class Builder {
|
||||
|
||||
/**
|
||||
* Build a Label Implementation Block
|
||||
*
|
||||
* @param string $labelName
|
||||
* @param string $implementationCode
|
||||
* @return string
|
||||
*/
|
||||
public static function getLabelImplementationBlock($labelName, $implementationCode) {
|
||||
$labelText = PHP_EOL . "***{$labelName}***" . PHP_EOL . "***{$implementationCode}***" . PHP_EOL;
|
||||
return $labelText;
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script;
|
||||
|
||||
use FML\Controls\Control;
|
||||
use FML\Script\Sections\Constants;
|
||||
use FML\Script\Sections\Labels;
|
||||
use FML\Types\Scriptable;
|
||||
|
||||
/**
|
||||
* ScriptFeature class offering menu behaviors
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class Menus implements Constants, Labels, ScriptFeature {
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
const C_MENUIDS = 'C_FML_MenuIds';
|
||||
|
||||
/**
|
||||
* Protected properties
|
||||
*/
|
||||
protected $menus = array();
|
||||
|
||||
/**
|
||||
* Add menu behavior defined by the given relationships
|
||||
*
|
||||
* @param array $menuRelationships
|
||||
* @return \FML\Script\Menus
|
||||
*/
|
||||
public function add(array $menuRelationships) {
|
||||
$menus = array();
|
||||
$subMenus = array();
|
||||
foreach ($menuRelationships as $relationship) {
|
||||
$menuItemControl = $relationship[0];
|
||||
$subMenuControl = $relationship[1];
|
||||
|
||||
if (!($menuItemControl instanceof Scriptable)) {
|
||||
trigger_error('No Scriptable instance given as menu item.', E_USER_ERROR);
|
||||
}
|
||||
if (!($subMenuControl instanceof Control)) {
|
||||
trigger_error('No Control instance given as sub menu.', E_USER_ERROR);
|
||||
}
|
||||
|
||||
$menuItemControl->assignId();
|
||||
$menuItemControl->setScriptEvents(true);
|
||||
$subMenuControl->assignId();
|
||||
|
||||
array_push($menus, array($menuItemControl->getId(), $subMenuControl->getId()));
|
||||
array_push($subMenus, $subMenuControl->getId());
|
||||
}
|
||||
array_push($this->menus, array($menus, $subMenus));
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Script\Sections\Constants::getConstants()
|
||||
*/
|
||||
public function getConstants() {
|
||||
$constant = '[';
|
||||
$index = 0;
|
||||
foreach ($this->menus as $menu) {
|
||||
$constant .= '[';
|
||||
foreach ($menu[0] as $menuRel) {
|
||||
$constant .= '"' . $menuRel[0] . '" => ["' . $menuRel[1] . '"], ';
|
||||
}
|
||||
$constant .= '"__FML__Sub__Menus__" => [';
|
||||
$subIndex = 0;
|
||||
foreach ($menu[1] as $subMenu) {
|
||||
$constant .= '"' . $subMenu . '"';
|
||||
if ($subIndex < count($menu[1]) - 1) {
|
||||
$constant .= ', ';
|
||||
}
|
||||
$subIndex++;
|
||||
}
|
||||
$constant .= ']]';
|
||||
if ($index < count($this->menus) - 1) {
|
||||
$constant .= ', ';
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$constant .= ']';
|
||||
$constants = array();
|
||||
$constants[self::C_MENUIDS] = $constant;
|
||||
return $constants;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Script\Sections\Labels::getLabels()
|
||||
*/
|
||||
public function getLabels() {
|
||||
$labels = array();
|
||||
$labelMouseClick = file_get_contents(__DIR__ . '/Templates/MenuMouseClick.txt');
|
||||
$labels[Labels::MOUSECLICK] = $labelMouseClick;
|
||||
return $labels;
|
||||
}
|
||||
}
|
@ -1,147 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script;
|
||||
|
||||
use FML\Controls\Control;
|
||||
use FML\Script\Sections\Constants;
|
||||
use FML\Script\Sections\Globals;
|
||||
use FML\Script\Sections\Includes;
|
||||
use FML\Script\Sections\Labels;
|
||||
use FML\Types\Scriptable;
|
||||
use FML\Controls\Label;
|
||||
|
||||
/**
|
||||
* ScriptFeature class offering paging
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class Pages implements Constants, Globals, Includes, Labels, ScriptFeature {
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
const C_PAGEIDS = 'C_FML_PageIds';
|
||||
|
||||
/**
|
||||
* Protected properties
|
||||
*/
|
||||
protected $pages = array();
|
||||
|
||||
/**
|
||||
* Add paging behavior
|
||||
*
|
||||
* @param array $pageButtons
|
||||
* @param array $pages
|
||||
* @param Label $counterLabel
|
||||
* @return \FML\Script\Pages
|
||||
*/
|
||||
public function add(array $pageButtons, array $pages, Label $counterLabel = null) {
|
||||
$actionIds = array();
|
||||
foreach ($pageButtons as $action => $pageButton) {
|
||||
if (!($pageButton instanceof Control)) {
|
||||
trigger_error('No Control instance given.', E_USER_ERROR);
|
||||
}
|
||||
$pageButton->assignId();
|
||||
if (!($pageButton instanceof Scriptable)) {
|
||||
trigger_error('No Scriptable instance given.', E_USER_ERROR);
|
||||
}
|
||||
$pageButton->setScriptEvents(true);
|
||||
|
||||
$actionIds[$pageButton->getId()] = $action;
|
||||
}
|
||||
|
||||
$pageIds = array();
|
||||
foreach ($pages as $page) {
|
||||
if (!($page instanceof Control)) {
|
||||
trigger_error('No Control instance given.', E_USER_ERROR);
|
||||
}
|
||||
$page->assignId();
|
||||
if (!empty($pageIds)) {
|
||||
$page->setVisible(false);
|
||||
}
|
||||
array_push($pageIds, $page->getId());
|
||||
}
|
||||
|
||||
if ($counterLabel) {
|
||||
$counterLabel->assignId();
|
||||
$counterId = $counterLabel->getId();
|
||||
}
|
||||
else {
|
||||
$counterId = uniqid();
|
||||
}
|
||||
|
||||
array_push($this->pages, array($actionIds, $pageIds, $counterId));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Script\Sections\Includes::getIncludes()
|
||||
*/
|
||||
public function getIncludes() {
|
||||
$includes = array();
|
||||
$includes["TextLib"] = "TextLib";
|
||||
return $includes;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Script\Sections\Constants::getConstants()
|
||||
*/
|
||||
public function getConstants() {
|
||||
$constant = '[';
|
||||
$index = 0;
|
||||
foreach ($this->pages as $page) {
|
||||
$constant .= '[';
|
||||
$actionIds = $page[0];
|
||||
foreach ($actionIds as $actionId => $action) {
|
||||
$constant .= '"' . $actionId . '" => ["' . $action . '"], ';
|
||||
}
|
||||
$constant .= '"__FML__Pages__Id__" => ["' . $page[2] . '"], ';
|
||||
$constant .= '"__FML__Pages__Ids__" => [';
|
||||
if (count($page[1]) <= 0) {
|
||||
$constant .= '""';
|
||||
}
|
||||
else {
|
||||
$subIndex = 0;
|
||||
foreach ($page[1] as $pageId) {
|
||||
$constant .= '"' . $pageId . '"';
|
||||
if ($subIndex < count($page[1]) - 1) {
|
||||
$constant .= ', ';
|
||||
}
|
||||
$subIndex++;
|
||||
}
|
||||
}
|
||||
$constant .= ']]';
|
||||
if ($index < count($this->pages) - 1) {
|
||||
$constant .= ', ';
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$constant .= ']';
|
||||
$constants = array();
|
||||
$constants[self::C_PAGEIDS] = $constant;
|
||||
return $constants;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Script\Sections\Globals::getGlobals()
|
||||
*/
|
||||
public function getGlobals() {
|
||||
$globals = array();
|
||||
$globals['G_FML_PageIndexes'] = 'Integer[Text]';
|
||||
return $globals;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Script\Sections\Labels::getLabels()
|
||||
*/
|
||||
public function getLabels() {
|
||||
$labels = array();
|
||||
$labelOnInit = file_get_contents(__DIR__ . '/Templates/PageOnInit.txt');
|
||||
$labels[Labels::ONINIT] = $labelOnInit;
|
||||
$labelMouseClick = file_get_contents(__DIR__ . '/Templates/PageMouseClick.txt');
|
||||
$labels[Labels::MOUSECLICK] = $labelMouseClick;
|
||||
return $labels;
|
||||
}
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
Void Dummy() {}
|
||||
|
||||
main() {
|
||||
declare FML_ScriptStart = Now;
|
||||
+++OnInit+++
|
||||
declare FML_LoopCounter = 0;
|
||||
while (True) {
|
||||
yield;
|
||||
foreach (Event in PendingEvents) {
|
||||
@ -24,5 +25,6 @@ main() {
|
||||
}
|
||||
}
|
||||
+++Loop+++
|
||||
FML_LoopCounter += 1;
|
||||
}
|
||||
}
|
@ -2,52 +2,205 @@
|
||||
|
||||
namespace FML\Script;
|
||||
|
||||
use FML\Script\Sections\Constants;
|
||||
use FML\Script\Sections\Functions;
|
||||
use FML\Script\Sections\Globals;
|
||||
use FML\Script\Sections\Includes;
|
||||
use FML\Script\Sections\Labels;
|
||||
use FML\Controls\Control;
|
||||
use FML\Types\Scriptable;
|
||||
use FML\Controls\Label;
|
||||
|
||||
/**
|
||||
* Class representing the Manialink Script
|
||||
* Class representing the ManiaLink Script
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class Script {
|
||||
/**
|
||||
* Protected properties
|
||||
* Constants
|
||||
*/
|
||||
protected $features = array();
|
||||
const CLASS_TOOLTIPS = "FML_Tooltips";
|
||||
const CLASS_MENU = "FML_Menu";
|
||||
const CLASS_MENUBUTTON = "FML_MenuButton";
|
||||
const CLASS_PAGE = "FML_Page";
|
||||
const CLASS_PAGER = "FML_Pager";
|
||||
const CLASS_PAGELABEL = "FML_PageLabel";
|
||||
const CLASS_PROFILE = "FML_Profile";
|
||||
const CLASS_MAPINFO = "FML_MapInfo";
|
||||
const LABEL_ONINIT = "OnInit";
|
||||
const LABEL_LOOP = "Loop";
|
||||
const LABEL_ENTRYSUBMIT = "EntrySubmit";
|
||||
const LABEL_KEYPRESS = "KeyPress";
|
||||
const LABEL_MOUSECLICK = "MouseClick";
|
||||
const LABEL_MOUSEOUT = "MouseOut";
|
||||
const LABEL_MOUSEOVER = "MouseOver";
|
||||
|
||||
/**
|
||||
* Add a script feature
|
||||
* Protected Properties
|
||||
*/
|
||||
protected $tagName = 'script';
|
||||
protected $includes = array();
|
||||
protected $tooltips = false;
|
||||
protected $menus = false;
|
||||
protected $pages = false;
|
||||
protected $profile = false;
|
||||
protected $mapInfo = false;
|
||||
|
||||
/**
|
||||
* Add an Include to the Script
|
||||
*
|
||||
* @param ScriptFeature $scriptFeature
|
||||
* @param string $namespace
|
||||
* @param string $file
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function addFeature(ScriptFeature $scriptFeature) {
|
||||
array_push($this->features, $scriptFeature);
|
||||
public function addInclude($namespace, $file) {
|
||||
$this->includes[$namespace] = $file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all script features
|
||||
* Add a Tooltip Behavior
|
||||
*
|
||||
* @param Control $hoverControl
|
||||
* @param Control $tooltipControl
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function removeFeatures() {
|
||||
$this->features = array();
|
||||
public function addTooltip(Control $hoverControl, Control $tooltipControl) {
|
||||
if (!($hoverControl instanceof Scriptable)) {
|
||||
trigger_error('Scriptable Control needed as HoverControl for Tooltips!');
|
||||
return $this;
|
||||
}
|
||||
$tooltipControl->checkId();
|
||||
$tooltipControl->setVisible(false);
|
||||
$hoverControl->setScriptEvents(true);
|
||||
$hoverControl->addClass(self::CLASS_TOOLTIPS);
|
||||
$hoverControl->addClass($tooltipControl->getId());
|
||||
$this->tooltips = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the script xml tag
|
||||
* Add a Menu Behavior
|
||||
*
|
||||
* @param Control $clickControl
|
||||
* @param Control $menuControl
|
||||
* @param string $menuId
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function addMenu(Control $clickControl, Control $menuControl, $menuId = null) {
|
||||
if (!($clickControl instanceof Scriptable)) {
|
||||
trigger_error('Scriptable Control needed as ClickControl for Menus!');
|
||||
return $this;
|
||||
}
|
||||
if (!$menuId) $menuId = '_';
|
||||
$menuControl->checkId();
|
||||
$menuControl->addClass(self::CLASS_MENU);
|
||||
$menuControl->addClass($menuId);
|
||||
$clickControl->setScriptEvents(true);
|
||||
$clickControl->addClass(self::CLASS_MENUBUTTON);
|
||||
$clickControl->addClass($menuId . '-' . $menuControl->getId());
|
||||
$this->addInclude('TextLib', 'TextLib');
|
||||
$this->menus = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Page for a Paging Behavior
|
||||
*
|
||||
* @param Control $pageControl
|
||||
* @param int $pageNumber
|
||||
* @param string $pagesId
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function addPage(Control $pageControl, $pageNumber, $pagesId = null) {
|
||||
$pageNumber = (int) $pageNumber;
|
||||
if (!$pagesId) $pagesId = '_';
|
||||
$pageControl->addClass(self::CLASS_PAGE);
|
||||
$pageControl->addClass($pagesId);
|
||||
$pageControl->addClass(self::CLASS_PAGE . '-P' . $pageNumber);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Pager Button for a Paging Behavior
|
||||
*
|
||||
* @param Control $pagerControl
|
||||
* @param int $pagingAction
|
||||
* @param string $pagesId
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function addPager(Control $pagerControl, $pagingAction, $pagesId = null) {
|
||||
if (!($pagerControl instanceof Scriptable)) {
|
||||
trigger_error('Scriptable Control needed as PagerControl for Pages!');
|
||||
return $this;
|
||||
}
|
||||
$pagingAction = (int) $pagingAction;
|
||||
if (!$pagesId) $pagesId = '_';
|
||||
$pagerControl->setScriptEvents(true);
|
||||
$pagerControl->addClass(self::CLASS_PAGER);
|
||||
$pagerControl->addClass(self::CLASS_PAGER . '-I' . $pagesId);
|
||||
$pagerControl->addClass(self::CLASS_PAGER . '-A' . $pagingAction);
|
||||
$this->addInclude('TextLib', 'TextLib');
|
||||
$this->pages = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Label that shows the current Page Number
|
||||
*
|
||||
* @param Label $pageLabel
|
||||
* @param string $pagesId
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function addPageLabel(Label $pageLabel, $pagesId = null) {
|
||||
if (!$pagesId) $pagesId = '_';
|
||||
$pageLabel->addClass(self::CLASS_PAGELABEL);
|
||||
$pageLabel->addClass($pagesId);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Button Behavior that will open the Built-In Player Profile
|
||||
*
|
||||
* @param Control $profileControl
|
||||
* @param string $playerLogin
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function addProfileButton(Control $profileControl, $playerLogin) {
|
||||
if (!($profileControl instanceof Scriptable)) {
|
||||
trigger_error('Scriptable Control needed as ClickControl for Profiles!');
|
||||
return $this;
|
||||
}
|
||||
$profileControl->setScriptEvents(true);
|
||||
$profileControl->addClass(self::CLASS_PROFILE);
|
||||
if ($playerLogin) {
|
||||
$profilControl->addClass(self::CLASS_PROFILE . '-' . $playerLogin);
|
||||
}
|
||||
$this->profile = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Button Behavior that will open the Built-In Map Info
|
||||
*
|
||||
* @param Control $mapInfoControl
|
||||
* @return \FML\Script\Script
|
||||
*/
|
||||
public function addMapInfoButton(Control $mapInfoControl) {
|
||||
if (!($mapInfoControl instanceof Scriptable)) {
|
||||
trigger_error('Scriptable Control needed as ClickControl for Map Info!');
|
||||
return $this;
|
||||
}
|
||||
$mapInfoControl->setScriptEvents(true);
|
||||
$mapInfoControl->addClass(self::CLASS_MAPINFO);
|
||||
$this->mapInfo = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the Script XML Tag
|
||||
*
|
||||
* @param \DOMDocument $domDocument
|
||||
* @return \DOMElement
|
||||
*/
|
||||
public function render(\DOMDocument $domDocument) {
|
||||
$scriptXml = $domDocument->createElement('script');
|
||||
$scriptXml = $domDocument->createElement($this->tagName);
|
||||
$scriptText = $this->buildScriptText();
|
||||
$scriptComment = $domDocument->createComment($scriptText);
|
||||
$scriptXml->appendChild($scriptComment);
|
||||
@ -55,162 +208,238 @@ class Script {
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the complete script text based on all script items
|
||||
* Build the complete Script Text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function buildScriptText() {
|
||||
$scriptText = "";
|
||||
$scriptText = $this->addHeaderPart($scriptText);
|
||||
$scriptText = $this->addIncludesPart($scriptText);
|
||||
$scriptText = $this->addConstantsPart($scriptText);
|
||||
$scriptText = $this->addGlobalsPart($scriptText);
|
||||
$scriptText = $this->addLabelsPart($scriptText);
|
||||
$scriptText = $this->addFunctionsPart($scriptText);
|
||||
$scriptText = $this->addMainPart($scriptText);
|
||||
$scriptText .= $this->getHeaderComment();
|
||||
$scriptText .= $this->getIncludes();
|
||||
if ($this->tooltips) {
|
||||
$scriptText .= $this->getTooltipLabels();
|
||||
}
|
||||
if ($this->menus) {
|
||||
$scriptText .= $this->getMenuLabels();
|
||||
}
|
||||
if ($this->pages) {
|
||||
$scriptText .= $this->getPagesLabels();
|
||||
}
|
||||
if ($this->profile) {
|
||||
$scriptText .= $this->getProfileLabels();
|
||||
}
|
||||
if ($this->mapInfo) {
|
||||
$scriptText .= $this->getMapInfoLabels();
|
||||
}
|
||||
$scriptText .= $this->getMainFunction();
|
||||
return $scriptText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the header comment to the script
|
||||
* Get the Header Comment
|
||||
*
|
||||
* @param string $scriptText
|
||||
* @return string
|
||||
*/
|
||||
private function addHeaderPart($scriptText) {
|
||||
$headerPart = file_get_contents(__DIR__ . '/Templates/Header.txt');
|
||||
return $scriptText . $headerPart;
|
||||
private function getHeaderComment() {
|
||||
$headerComment = file_get_contents(__DIR__ . '/Parts/Header.txt');
|
||||
return $headerComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the includes to the script
|
||||
* Get the Includes
|
||||
*
|
||||
* @param string $scriptText
|
||||
* @return string
|
||||
*/
|
||||
private function addIncludesPart($scriptText) {
|
||||
$includes = array();
|
||||
foreach ($this->features as $feature) {
|
||||
if (!($feature instanceof Includes)) {
|
||||
continue;
|
||||
private function getIncludes() {
|
||||
$includesText = PHP_EOL;
|
||||
foreach ($this->includes as $namespace => $file) {
|
||||
$includesText .= "#Include \"{$file}\" as {$namespace}" . PHP_EOL;
|
||||
}
|
||||
$featureIncludes = $feature->getIncludes();
|
||||
foreach ($featureIncludes as $namespace => $fileName) {
|
||||
$includes[$namespace] = $fileName;
|
||||
}
|
||||
}
|
||||
$includesPart = PHP_EOL;
|
||||
foreach ($includes as $namespace => $fileName) {
|
||||
$includesPart .= "#Include \"{$fileName}\" as {$namespace}" . PHP_EOL;
|
||||
}
|
||||
return $scriptText . $includesPart;
|
||||
return $includesText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the declared constants to the script
|
||||
* Get the Tooltip Labels
|
||||
*
|
||||
* @param string $scriptText
|
||||
* @return string
|
||||
*/
|
||||
private function addConstantsPart($scriptText) {
|
||||
$constants = array();
|
||||
foreach ($this->features as $feature) {
|
||||
if (!($feature instanceof Constants)) {
|
||||
continue;
|
||||
private function getTooltipLabels() {
|
||||
$mouseOverScript = "
|
||||
if (Event.Control.HasClass(\"" . self::CLASS_TOOLTIPS . "\")) {
|
||||
foreach (ControlClass in Event.Control.ControlClasses) {
|
||||
declare TooltipControl <=> Page.GetFirstChild(ControlClass);
|
||||
if (TooltipControl == Null) continue;
|
||||
TooltipControl.Show();
|
||||
}
|
||||
$featureConstants = $feature->getConstants();
|
||||
foreach ($featureConstants as $name => $value) {
|
||||
$constants[$name] = $value;
|
||||
}";
|
||||
$mouseOutScript = "
|
||||
if (Event.Control.HasClass(\"" . self::CLASS_TOOLTIPS . "\")) {
|
||||
foreach (ControlClass in Event.Control.ControlClasses) {
|
||||
declare TooltipControl <=> Page.GetFirstChild(ControlClass);
|
||||
if (TooltipControl == Null) continue;
|
||||
TooltipControl.Hide();
|
||||
}
|
||||
}
|
||||
$constantsPart = PHP_EOL;
|
||||
foreach ($constants as $name => $value) {
|
||||
$constantsPart .= "#Const {$name} {$value}" . PHP_EOL;
|
||||
}
|
||||
return $scriptText . $constantsPart;
|
||||
}";
|
||||
$tooltipsLabels = Builder::getLabelImplementationBlock(self::LABEL_MOUSEOVER, $mouseOverScript);
|
||||
$tooltipsLabels .= Builder::getLabelImplementationBlock(self::LABEL_MOUSEOUT, $mouseOutScript);
|
||||
return $tooltipsLabels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the declared global variables to the script
|
||||
* Get the Menu Labels
|
||||
*
|
||||
* @param string $scriptText
|
||||
* @return string
|
||||
*/
|
||||
private function addGlobalsPart($scriptText) {
|
||||
$globals = array();
|
||||
foreach ($this->features as $feature) {
|
||||
if (!($feature instanceof Globals)) {
|
||||
continue;
|
||||
private function getMenuLabels() {
|
||||
$mouseClickScript = "
|
||||
if (Event.Control.HasClass(\"" . self::CLASS_MENUBUTTON . "\")) {
|
||||
declare Text MenuIdClass;
|
||||
declare Text MenuControlId;
|
||||
foreach (ControlClass in Event.Control.ControlClasses) {
|
||||
declare ClassParts = TextLib::Split(\"-\", ControlClass);
|
||||
if (ClassParts.count <= 1) continue;
|
||||
MenuIdClass = ClassParts[0];
|
||||
MenuControlId = ClassParts[1];
|
||||
break;
|
||||
}
|
||||
$featureGlobals = $feature->getGlobals();
|
||||
foreach ($featureGlobals as $name => $type) {
|
||||
$globals[$name] = $type;
|
||||
Page.GetClassChildren(MenuIdClass, Page.MainFrame, True);
|
||||
foreach (MenuControl in Page.GetClassChildren_Result) {
|
||||
if (!MenuControl.HasClass(\"" . self::CLASS_MENU . "\")) continue;
|
||||
if (MenuControlId != MenuControl.Id) {
|
||||
MenuControl.Hide();
|
||||
} else {
|
||||
MenuControl.Show();
|
||||
}
|
||||
}
|
||||
$globalsPart = PHP_EOL;
|
||||
foreach ($globals as $name => $type) {
|
||||
$globalsPart .= "declare {$type} {$name};" . PHP_EOL;
|
||||
}
|
||||
return $scriptText . $globalsPart;
|
||||
}";
|
||||
$menuLabels = Builder::getLabelImplementationBlock(self::LABEL_MOUSECLICK, $mouseClickScript);
|
||||
return $menuLabels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the implemented labels to the script
|
||||
* Get the Pages Labels
|
||||
*
|
||||
* @param string $scriptText
|
||||
* @return string
|
||||
*/
|
||||
private function addLabelsPart($scriptText) {
|
||||
$labels = array();
|
||||
foreach ($this->features as $feature) {
|
||||
if (!($feature instanceof Labels)) {
|
||||
continue;
|
||||
private function getPagesLabels() {
|
||||
$pagesNumberPrefix = self::CLASS_PAGE . '-P';
|
||||
$pagesNumberPrefixLength = strlen($pagesNumberPrefix);
|
||||
$pagesScript = "
|
||||
if (Event.Control.HasClass(\"" . self::CLASS_PAGER . "\")) {
|
||||
declare Text PagesId;
|
||||
declare Integer PagingAction;
|
||||
foreach (ControlClass in Event.Control.ControlClasses) {
|
||||
declare ClassParts = TextLib::Split(\"-\", ControlClass);
|
||||
if (ClassParts.count <= 1) continue;
|
||||
if (ClassParts[0] != \"" . self::CLASS_PAGER . "\") continue;
|
||||
switch (TextLib::SubText(ClassParts[1], 0, 1)) {
|
||||
case \"I\": {
|
||||
PagesId = TextLib::SubText(ClassParts[1], 1, 99);
|
||||
}
|
||||
$featureLabels = $feature->getLabels();
|
||||
foreach ($featureLabels as $name => $implementation) {
|
||||
$label = array($name, $implementation);
|
||||
array_push($labels, $label);
|
||||
case \"A\": {
|
||||
PagingAction = TextLib::ToInteger(TextLib::SubText(ClassParts[1], 1, 99));
|
||||
}
|
||||
}
|
||||
$labelsPart = PHP_EOL;
|
||||
foreach ($labels as $label) {
|
||||
$labelsPart .= '***' . $label[0] . '***' . PHP_EOL . '***' . PHP_EOL . $label[1] . PHP_EOL . '***' . PHP_EOL;
|
||||
}
|
||||
return $scriptText . $labelsPart;
|
||||
declare FML_PagesLastScriptStart for This = FML_ScriptStart;
|
||||
declare FML_MinPageNumber for This = Integer[Text];
|
||||
declare FML_MaxPageNumber for This = Integer[Text];
|
||||
declare FML_PageNumber for This = Integer[Text];
|
||||
if (FML_PagesLastScriptStart != FML_ScriptStart || !FML_PageNumber.existskey(PagesId) || !FML_MinPageNumber.existskey(PagesId) || !FML_MaxPageNumber.existskey(PagesId)) {
|
||||
Page.GetClassChildren(PagesId, Page.MainFrame, True);
|
||||
foreach (PageControl in Page.GetClassChildren_Result) {
|
||||
if (!PageControl.HasClass(\"" . self::CLASS_PAGE . "\")) continue;
|
||||
foreach (ControlClass in PageControl.ControlClasses) {
|
||||
if (TextLib::SubText(ControlClass, 0, {$pagesNumberPrefixLength}) != \"{$pagesNumberPrefix}\") continue;
|
||||
declare PageNumber = TextLib::ToInteger(TextLib::SubText(ControlClass, {$pagesNumberPrefixLength}, 99));
|
||||
if (!FML_MinPageNumber.existskey(PagesId) || PageNumber < FML_MinPageNumber[PagesId]) {
|
||||
FML_MinPageNumber[PagesId] = PageNumber;
|
||||
}
|
||||
if (!FML_MaxPageNumber.existskey(PagesId) || PageNumber > FML_MaxPageNumber[PagesId]) {
|
||||
FML_MaxPageNumber[PagesId] = PageNumber;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
FML_PageNumber[PagesId] = FML_MinPageNumber[PagesId];
|
||||
}
|
||||
FML_PageNumber[PagesId] += PagingAction;
|
||||
if (FML_PageNumber[PagesId] < FML_MinPageNumber[PagesId]) {
|
||||
FML_PageNumber[PagesId] = FML_MinPageNumber[PagesId];
|
||||
}
|
||||
if (FML_PageNumber[PagesId] > FML_MaxPageNumber[PagesId]) {
|
||||
FML_PageNumber[PagesId] = FML_MaxPageNumber[PagesId];
|
||||
}
|
||||
FML_PagesLastScriptStart = FML_ScriptStart;
|
||||
Page.GetClassChildren(PagesId, Page.MainFrame, True);
|
||||
foreach (PageControl in Page.GetClassChildren_Result) {
|
||||
if (!PageControl.HasClass(\"" . self::CLASS_PAGE . "\")) continue;
|
||||
declare PageNumber = -1;
|
||||
foreach (ControlClass in PageControl.ControlClasses) {
|
||||
if (TextLib::SubText(ControlClass, 0, {$pagesNumberPrefixLength}) != \"{$pagesNumberPrefix}\") continue;
|
||||
PageNumber = TextLib::ToInteger(TextLib::SubText(ControlClass, {$pagesNumberPrefixLength}, 99));
|
||||
break;
|
||||
}
|
||||
if (PageNumber != FML_PageNumber[PagesId]) {
|
||||
PageControl.Hide();
|
||||
} else {
|
||||
PageControl.Show();
|
||||
}
|
||||
}
|
||||
Page.GetClassChildren(\"".self::CLASS_PAGELABEL."\", Page.MainFrame, True);
|
||||
foreach (PageControl in Page.GetClassChildren_Result) {
|
||||
if (!PageControl.HasClass(PagesId)) continue;
|
||||
declare PageLabel <=> (PageControl as CMlLabel);
|
||||
PageLabel.Value = (FML_PageNumber[PagesId]+1)^\"/\"^(FML_MaxPageNumber[PagesId]+1);
|
||||
}
|
||||
}";
|
||||
$pagesLabels = Builder::getLabelImplementationBlock(self::LABEL_MOUSECLICK, $pagesScript);
|
||||
return $pagesLabels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the declared functions to the script
|
||||
* Get the Profile Labels
|
||||
*
|
||||
* @param string $scriptText
|
||||
* @return string
|
||||
*/
|
||||
private function addFunctionsPart($scriptText) {
|
||||
$functions = array();
|
||||
foreach ($this->features as $feature) {
|
||||
if (!($feature instanceof Functions)) {
|
||||
continue;
|
||||
private function getProfileLabels() {
|
||||
$profileScript = "
|
||||
if (Event.Control.HasClass(\"" . self::CLASS_PROFILE . "\") {
|
||||
declare Login = LocalUser.Login;
|
||||
foreach (ControlClass in Event.Control.ControlClasses) {
|
||||
declare ClassParts = TextLib::Split(\"-\", ControlClass);
|
||||
if (ClassParts.count <= 1) continue;
|
||||
if (ClassParts[0] != \"" . self::CLASS_PROFILE . "\") continue;
|
||||
Login = ClassParts[1];
|
||||
break;
|
||||
}
|
||||
$featureFunctions = $feature->getFunctions();
|
||||
foreach ($featureFunctions as $signature => $implementation) {
|
||||
$functions[$signature] = $implementation;
|
||||
}
|
||||
}
|
||||
$functionsPart = PHP_EOL;
|
||||
foreach ($functions as $signature => $implementation) {
|
||||
$functionsPart .= $signature . '{' . PHP_EOL . $implementation . PHP_EOL . '}' . PHP_EOL;
|
||||
}
|
||||
return $scriptText . $functionsPart;
|
||||
ShowProfile(Login);
|
||||
}";
|
||||
$profileLabels = Builder::getLabelImplementationBlock(self::LABEL_MOUSECLICK, $profileScript);
|
||||
return $profileLabels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the main function to the script
|
||||
* Get the Map Info Labels
|
||||
*
|
||||
* @param string $scriptText
|
||||
* @return string
|
||||
*/
|
||||
private function addMainPart($scriptText) {
|
||||
$mainPart = file_get_contents(__DIR__ . '/Templates/Main.txt');
|
||||
return $scriptText . $mainPart;
|
||||
private function getMapInfoLabels() {
|
||||
$mapInfoScript = "
|
||||
if (Event.Control.HasClass(\"" . self::CLASS_MAPINFO . "\") {
|
||||
ShowCurChallengeCard();
|
||||
}";
|
||||
$mapInfoLabels = Builder::getLabelImplementationBlock(self::LABEL_MOUSECLICK, $mapInfoScript);
|
||||
return $mapInfoLabels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Main Function
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getMainFunction() {
|
||||
$mainFunction = file_get_contents(__DIR__ . '/Parts/Main.txt');
|
||||
return $mainFunction;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script;
|
||||
|
||||
/**
|
||||
* Interface representing a script feature
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
interface ScriptFeature {
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script\Sections;
|
||||
|
||||
/**
|
||||
* Script feature using constants
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
interface Constants {
|
||||
|
||||
/**
|
||||
* Return array of constant values with names as keys
|
||||
*/
|
||||
public function getConstants();
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script\Sections;
|
||||
|
||||
/**
|
||||
* Script feature using functions
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
interface Functions {
|
||||
|
||||
/**
|
||||
* Return array of function implementations and signatures as keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFunctions();
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script\Sections;
|
||||
|
||||
/**
|
||||
* Script feature using globals
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
interface Globals {
|
||||
|
||||
/**
|
||||
* Return array with global variable types with variable names as keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getGlobals();
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script\Sections;
|
||||
|
||||
/**
|
||||
* Script feature using includes
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
interface Includes {
|
||||
|
||||
/**
|
||||
* Return array of included files with namespaces as keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getIncludes();
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script\Sections;
|
||||
|
||||
/**
|
||||
* Script feature using labels
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
interface Labels {
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
const ENTRYSUBMIT = 'EntrySubmit';
|
||||
const KEYPRESS = 'KeyPress';
|
||||
const LOOP = 'Loop';
|
||||
const MOUSECLICK = 'MouseClick';
|
||||
const MOUSEOUT = 'MouseOut';
|
||||
const MOUSEOVER = 'MouseOver';
|
||||
const ONINIT = 'OnInit';
|
||||
|
||||
/**
|
||||
* Return array of label implementations with label names as keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLabels();
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
foreach (MenuIds in C_FML_MenuIds) {
|
||||
if (!MenuIds.existskey(Event.ControlId)) continue;
|
||||
|
||||
declare MenuId = MenuIds[Event.ControlId][0];
|
||||
declare SubMenuIds = MenuIds["__FML__Sub__Menus__"];
|
||||
|
||||
foreach (SubMenuId in SubMenuIds) {
|
||||
declare SubMenu <=> Page.GetFirstChild(SubMenuId);
|
||||
if (SubMenu == Null) continue;
|
||||
SubMenu.Visible = (SubMenu.ControlId == MenuId);
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
foreach (PageIds in C_FML_PageIds) {
|
||||
if (!PageIds.existskey(Event.ControlId)) continue;
|
||||
|
||||
declare Action = TextLib::ToInteger(PageIds[Event.ControlId][0]);
|
||||
declare PagesId = PageIds["__FML__Pages__Id__"][0];
|
||||
declare PagesIds = PageIds["__FML__Pages__Ids__"];
|
||||
|
||||
if (!G_FML_PageIndexes.existskey(PagesId)) {
|
||||
G_FML_PageIndexes[PagesId] = 0;
|
||||
}
|
||||
G_FML_PageIndexes[PagesId] += Action;
|
||||
if (G_FML_PageIndexes[PagesId] < 0) {
|
||||
G_FML_PageIndexes[PagesId] = 0;
|
||||
} else if (G_FML_PageIndexes[PagesId] >= PagesIds.count) {
|
||||
G_FML_PageIndexes[PagesId] = PagesIds.count - 1;
|
||||
}
|
||||
|
||||
foreach (PageIndex => PageId in PagesIds) {
|
||||
declare Control <=> Page.GetFirstChild(PageId);
|
||||
if (Control == Null) continue;
|
||||
Control.Visible = (PageIndex == G_FML_PageIndexes[PagesId]);
|
||||
}
|
||||
|
||||
declare Label_Counter <=> (Page.GetFirstChild(PagesId) as CMlLabel);
|
||||
if (Label_Counter == Null) continue;
|
||||
Label_Counter.Value = (G_FML_PageIndexes[PagesId]+1)^"/"^PagesIds.count;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
foreach (PageIds in C_FML_PageIds) {
|
||||
declare PagesId = PageIds["__FML__Pages__Id__"][0];
|
||||
declare PagesIds = PageIds["__FML__Pages__Ids__"];
|
||||
|
||||
if (!G_FML_PageIndexes.existskey(PagesId)) {
|
||||
G_FML_PageIndexes[PagesId] = 0;
|
||||
}
|
||||
|
||||
foreach (PageIndex => PageId in PagesIds) {
|
||||
declare Control <=> Page.GetFirstChild(PageId);
|
||||
if (Control == Null) continue;
|
||||
Control.Visible = (PageIndex == G_FML_PageIndexes[PagesId]);
|
||||
}
|
||||
|
||||
declare Label_Counter <=> (Page.GetFirstChild(PagesId) as CMlLabel);
|
||||
if (Label_Counter == Null) continue;
|
||||
Label_Counter.Value = (G_FML_PageIndexes[PagesId]+1)^"/"^PagesIds.count;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
if (C_FML_TooltipIds.existskey(Event.ControlId)) {
|
||||
declare TooltipControl <=> Page.GetFirstChild(C_FML_TooltipIds[Event.ControlId]);
|
||||
if (TooltipControl != Null) {
|
||||
TooltipControl.Hide();
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
if (C_FML_TooltipIds.existskey(Event.ControlId)) {
|
||||
declare TooltipControl <=> Page.GetFirstChild(C_FML_TooltipIds[Event.ControlId]);
|
||||
if (TooltipControl != Null) {
|
||||
TooltipControl.Show();
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace FML\Script;
|
||||
|
||||
use FML\Controls\Control;
|
||||
use FML\Script\Sections\Constants;
|
||||
use FML\Script\Sections\Labels;
|
||||
use FML\Types\Scriptable;
|
||||
|
||||
/**
|
||||
* ScriptFeature class offering tooltip behaviors
|
||||
*
|
||||
* @author steeffeen
|
||||
*/
|
||||
class Tooltips implements Constants, Labels, ScriptFeature {
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
const C_TOOLTIPIDS = 'C_FML_TooltipIds';
|
||||
|
||||
/**
|
||||
* Protected properties
|
||||
*/
|
||||
protected $tooltips = array();
|
||||
|
||||
/**
|
||||
* Add a tooltip behavior showing the tooltipControl while hovering over the hoverControl
|
||||
*
|
||||
* @param Scriptable $hoverControl
|
||||
* @param Control $tooltipControl
|
||||
* @return \FML\Script\Tooltips
|
||||
*/
|
||||
public function add(Scriptable $hoverControl, Control $tooltipControl) {
|
||||
if ($hoverControl instanceof Control) {
|
||||
$hoverControl->assignId();
|
||||
}
|
||||
$hoverControl->setScriptEvents(true);
|
||||
$tooltipControl->assignId();
|
||||
$tooltipControl->setVisible(false);
|
||||
$this->tooltips[$hoverControl->getId()] = $tooltipControl->getId();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Script\Sections\Constants::getConstants()
|
||||
*/
|
||||
public function getConstants() {
|
||||
$constant = '[';
|
||||
if (count($this->tooltips) <= 0) {
|
||||
$constant .= '"" => ""';
|
||||
}
|
||||
else {
|
||||
$index = 0;
|
||||
foreach ($this->tooltips as $hoverId => $tooltipId) {
|
||||
$constant .= '"' . $hoverId . '" => "' . $tooltipId . '"';
|
||||
if ($index < count($this->tooltips) - 1) {
|
||||
$constant .= ',';
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
$constant .= ']';
|
||||
$constants = array();
|
||||
$constants[self::C_TOOLTIPIDS] = $constant;
|
||||
return $constants;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see \FML\Script\Sections\Labels::getLabels()
|
||||
*/
|
||||
public function getLabels() {
|
||||
$labels = array();
|
||||
$labelMouseOut = file_get_contents(__DIR__ . '/Templates/TooltipMouseOut.txt');
|
||||
$labels[Labels::MOUSEOUT] = $labelMouseOut;
|
||||
$labelMouseOver = file_get_contents(__DIR__ . '/Templates/TooltipMouseOver.txt');
|
||||
$labels[Labels::MOUSEOVER] = $labelMouseOver;
|
||||
return $labels;
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ interface Actionable {
|
||||
* Set action
|
||||
*
|
||||
* @param string $action
|
||||
* Action Name
|
||||
*/
|
||||
public function setAction($action);
|
||||
}
|
||||
|
@ -10,9 +10,10 @@ namespace FML\Types;
|
||||
interface BgColorable {
|
||||
|
||||
/**
|
||||
* Set background color
|
||||
* Set Background Color
|
||||
*
|
||||
* @param string $bgColor
|
||||
* Background Color
|
||||
*/
|
||||
public function setBgColor($bgColor);
|
||||
}
|
||||
|
@ -10,14 +10,15 @@ namespace FML\Types;
|
||||
interface Container {
|
||||
|
||||
/**
|
||||
* Add a new child
|
||||
* Add a new Child
|
||||
*
|
||||
* @param Renderable $child
|
||||
* The child to add
|
||||
*/
|
||||
public function add(Renderable $child);
|
||||
|
||||
/**
|
||||
* Remove all children
|
||||
* Remove all Children
|
||||
*/
|
||||
public function removeChildren();
|
||||
}
|
||||
|
@ -10,16 +10,18 @@ namespace FML\Types;
|
||||
interface Linkable {
|
||||
|
||||
/**
|
||||
* Set url
|
||||
* Set Url
|
||||
*
|
||||
* @param string $url
|
||||
* Link Url
|
||||
*/
|
||||
public function setUrl($url);
|
||||
|
||||
/**
|
||||
* Set manialink
|
||||
* Set Manialink
|
||||
*
|
||||
* @param string $manialink
|
||||
* Manialink Name
|
||||
*/
|
||||
public function setManialink($manialink);
|
||||
}
|
||||
|
@ -10,9 +10,10 @@ namespace FML\Types;
|
||||
interface NewLineable {
|
||||
|
||||
/**
|
||||
* Set auto new line
|
||||
* Set Auto New Line
|
||||
*
|
||||
* @param bool $autoNewLine
|
||||
* If the Control should insert New Lines automatically
|
||||
*/
|
||||
public function setAutoNewLine($autoNewLine);
|
||||
}
|
||||
|
@ -10,37 +10,42 @@ namespace FML\Types;
|
||||
interface Playable {
|
||||
|
||||
/**
|
||||
* Set data
|
||||
* Set Data
|
||||
*
|
||||
* @param string $data
|
||||
* Media Url
|
||||
*/
|
||||
public function setData($data);
|
||||
|
||||
/**
|
||||
* Set play
|
||||
* Set Play
|
||||
*
|
||||
* @param bool $play
|
||||
* If the Control should start playing automatically
|
||||
*/
|
||||
public function setPlay($play);
|
||||
|
||||
/**
|
||||
* Set looping
|
||||
* Set Looping
|
||||
*
|
||||
* @param bool $looping
|
||||
* If the Control should playback looping
|
||||
*/
|
||||
public function setLooping($looping);
|
||||
|
||||
/**
|
||||
* Set music
|
||||
* Set Music
|
||||
*
|
||||
* @param bool $music
|
||||
* If the Control is Background Music
|
||||
*/
|
||||
public function setMusic($music);
|
||||
|
||||
/**
|
||||
* Set volume
|
||||
* Set Volume
|
||||
*
|
||||
* @param float $volume
|
||||
* Control Volume
|
||||
*/
|
||||
public function setVolume($volume);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace FML\Types;
|
||||
interface Renderable {
|
||||
|
||||
/**
|
||||
* Render the xml element
|
||||
* Render the XML Element
|
||||
*
|
||||
* @param \DOMDocument $domDocument
|
||||
* @return \DOMElement
|
||||
|
@ -10,9 +10,10 @@ namespace FML\Types;
|
||||
interface Scriptable {
|
||||
|
||||
/**
|
||||
* Set scriptevents
|
||||
* Set ScriptEvents
|
||||
*
|
||||
* @param bool $scriptEvents
|
||||
* If Script Events should be enabled
|
||||
*/
|
||||
public function setScriptEvents($scriptEvents);
|
||||
}
|
||||
|
@ -10,9 +10,10 @@ namespace FML\Types;
|
||||
interface Styleable {
|
||||
|
||||
/**
|
||||
* Set style
|
||||
* Set Style
|
||||
*
|
||||
* @param string $style
|
||||
* Style
|
||||
*/
|
||||
public function setStyle($style);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ interface SubStyleable {
|
||||
* Set SubStyle
|
||||
*
|
||||
* @param string $subStyle
|
||||
* Sub-Style
|
||||
*/
|
||||
public function setSubStyle($subStyle);
|
||||
|
||||
@ -20,7 +21,9 @@ interface SubStyleable {
|
||||
* Set Style and SubStyle
|
||||
*
|
||||
* @param string $style
|
||||
* Style
|
||||
* @param string $subStyle
|
||||
* Sub-Style
|
||||
*/
|
||||
public function setStyles($style, $subStyle);
|
||||
}
|
||||
|
@ -10,30 +10,34 @@ namespace FML\Types;
|
||||
interface TextFormatable {
|
||||
|
||||
/**
|
||||
* Set text size
|
||||
* Set Text Size
|
||||
*
|
||||
* @param int $textSize
|
||||
* Text Size
|
||||
*/
|
||||
public function setTextSize($textSize);
|
||||
|
||||
/**
|
||||
* Set text color
|
||||
* Set Text Color
|
||||
*
|
||||
* @param string $textColor
|
||||
* Text Color
|
||||
*/
|
||||
public function setTextColor($textColor);
|
||||
|
||||
/**
|
||||
* Set area color
|
||||
* Set Area Color
|
||||
*
|
||||
* @param string $areaColor
|
||||
* Area Text Color
|
||||
*/
|
||||
public function setAreaColor($areaColor);
|
||||
|
||||
/**
|
||||
* Set area focus color
|
||||
* Set Area Focus Color
|
||||
*
|
||||
* @param string $areaFocusColor
|
||||
* Focus Area Color
|
||||
*/
|
||||
public function setAreaFocusColor($areaFocusColor);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user