removed 'application' folder to have everything in the root directory

This commit is contained in:
Steffen Schröder
2014-09-29 18:20:09 +02:00
parent 1569fd5488
commit 9642433363
284 changed files with 4 additions and 50 deletions

View File

@ -0,0 +1,285 @@
<?php
namespace FML\Stylesheet;
// Warning: The mood class isn't fully supported yet!
// Missing attributes: LDir1..
/**
* Class representing a Stylesheet Mood
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Mood {
/*
* Protected properties
*/
protected $tagName = 'mood';
protected $lAmbient_LinearRgb = null;
protected $cloudsRgbMinLinear = null;
protected $cloudsRgbMaxLinear = null;
protected $lDir0_LinearRgb = null;
protected $lDir0_Intens = 1.;
protected $lDir0_DirPhi = 0.;
protected $lDir0_DirTheta = 0.;
protected $lBall_LinearRgb = null;
protected $lBall_Intensity = 1.;
protected $lBall_Radius = 0.;
protected $fogColorSrgb = null;
protected $selfIllumColor = null;
protected $skyGradientV_Scale = 1.;
protected $skyGradientKeys = array();
/**
* Create a new Mood object
*
* @return static
*/
public static function create() {
return new static();
}
/**
* Set ambient color in which the Elements reflect the light
*
* @param float $red Red color value
* @param float $green Green color value
* @param float $blue Blue color value
* @return static
*/
public function setLightAmbientColor($red, $green, $blue) {
$this->lAmbient_LinearRgb = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
}
/**
* Set minimum value for the background color range
*
* @param float $red Red color value
* @param float $green Green color value
* @param float $blue Blue color value
* @return static
*/
public function setCloudsColorMin($red, $green, $blue) {
$this->cloudsRgbMinLinear = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
}
/**
* Set maximum value for the background color range
*
* @param float $red Red color value
* @param float $green Green color value
* @param float $blue Blue color value
* @return static
*/
public function setCloudsColorMax($red, $green, $blue) {
$this->cloudsRgbMaxLinear = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
}
/**
* Set RGB color of light source 0
*
* @param float $red Red color value
* @param float $green Green color value
* @param float $blue Blue color value
* @return static
*/
public function setLight0Color($red, $green, $blue) {
$this->lDir0_LinearRgb = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
}
/**
* Set intensity of light source 0
*
* @param float $intensity Light intensity
* @return static
*/
public function setLight0Intensity($intensity) {
$this->lDir0_Intens = (float)$intensity;
return $this;
}
/**
* Set phi angle of light source 0
*
* @param float $phiAngle Phi angle
* @return static
*/
public function setLight0PhiAngle($phiAngle) {
$this->lDir0_DirPhi = (float)$phiAngle;
return $this;
}
/**
* Set theta angle of light source 0
*
* @param float $thetaAngle Theta angle
* @return static
*/
public function setLight0ThetaAngle($thetaAngle) {
$this->lDir0_DirTheta = (float)$thetaAngle;
return $this;
}
/**
* Set light ball color
*
* @param float $red Red color value
* @param float $green Green color value
* @param float $blue Blue color value
* @return static
*/
public function setLightBallColor($red, $green, $blue) {
$this->lBall_LinearRgb = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
}
/**
* Set light ball intensity
*
* @param float $intensity Light ball intensity
* @return static
*/
public function setLightBallIntensity($intensity) {
$this->lBall_Intensity = (float)$intensity;
return $this;
}
/**
* Set light ball radius
*
* @param float $radius Light ball radius
* @return static
*/
public function setLightBallRadius($radius) {
$this->lBall_Radius = (float)$radius;
return $this;
}
/**
* Set fog color
*
* @param float $red Red color value
* @param float $green Green color value
* @param float $blue Blue color value
* @return static
*/
public function setFogColor($red, $green, $blue) {
$this->fogColorSrgb = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
}
/**
* Set self illumination color
*
* @param float $red Red color value
* @param float $green Green color value
* @param float $blue Blue color value
* @return static
*/
public function setSelfIllumColor($red, $green, $blue) {
$this->selfIllumColor = floatval($red) . ' ' . floatval($green) . ' ' . floatval($blue);
return $this;
}
/**
* Set sky gradient scale
*
* @param float $scale Gradient scale
* @return static
*/
public function setSkyGradientScale($scale) {
$this->skyGradientV_Scale = (float)$scale;
return $this;
}
/**
* Add a sky gradient key
*
* @param float $gradientX Scale value
* @param string $color Gradient color
* @return static
*/
public function addSkyGradientKey($gradientX, $color) {
$gradientX = (float)$gradientX;
$color = (string)$color;
$gradientKey = array('x' => $gradientX, 'color' => $color);
array_push($this->skyGradientKeys, $gradientKey);
return $this;
}
/**
* Remove all sky gradient keys
*
* @return static
*/
public function removeSkyGradientKeys() {
$this->skyGradientKeys = array();
return $this;
}
/**
* Render the Mood XML element
*
* @param \DOMDocument $domDocument DOMDocument for which the Mood XML element should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument) {
$moodXml = $domDocument->createElement($this->tagName);
if ($this->lAmbient_LinearRgb) {
$moodXml->setAttribute('LAmbient_LinearRgb', $this->lAmbient_LinearRgb);
}
if ($this->cloudsRgbMinLinear) {
$moodXml->setAttribute('CloudsRgbMinLinear', $this->cloudsRgbMinLinear);
}
if ($this->cloudsRgbMaxLinear) {
$moodXml->setAttribute('CloudsRgbMaxLinear', $this->cloudsRgbMaxLinear);
}
if ($this->lDir0_LinearRgb) {
$moodXml->setAttribute('LDir0_LinearRgb', $this->lDir0_LinearRgb);
}
if ($this->lDir0_Intens) {
$moodXml->setAttribute('LDir0_Intens', $this->lDir0_Intens);
}
if ($this->lDir0_DirPhi) {
$moodXml->setAttribute('LDir0_DirPhi', $this->lDir0_DirPhi);
}
if ($this->lDir0_DirTheta) {
$moodXml->setAttribute('LDir0_DirTheta', $this->lDir0_DirTheta);
}
if ($this->lBall_LinearRgb) {
$moodXml->setAttribute('LBall_LinearRgb', $this->lBall_LinearRgb);
}
if ($this->lBall_Intensity) {
$moodXml->setAttribute('LBall_Intens', $this->lBall_Intensity);
}
if ($this->lBall_Radius) {
$moodXml->setAttribute('LBall_Radius', $this->lBall_Radius);
}
if ($this->fogColorSrgb) {
$moodXml->setAttribute('FogColorSrgb', $this->fogColorSrgb);
}
if ($this->selfIllumColor) {
$moodXml->setAttribute('SelfIllumColor', $this->selfIllumColor);
}
if ($this->skyGradientV_Scale) {
$moodXml->setAttribute('SkyGradientV_Scale', $this->skyGradientV_Scale);
}
if ($this->skyGradientKeys) {
$skyGradientXml = $domDocument->createElement('skygradient');
$moodXml->appendChild($skyGradientXml);
foreach ($this->skyGradientKeys as $gradientKey) {
$keyXml = $domDocument->createElement('key');
$skyGradientXml->appendChild($keyXml);
$keyXml->setAttribute('x', $gradientKey['x']);
$keyXml->setAttribute('color', $gradientKey['color']);
}
}
return $moodXml;
}
}

View File

@ -0,0 +1,247 @@
<?php
namespace FML\Stylesheet;
use FML\UniqueID;
/**
* Class representing a Style3d
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Style3d {
/*
* Constants
*/
const MODEL_Box = 'Box';
const MODEL_Button = 'Button';
const MODEL_ButtonH = 'ButtonH';
const MODEL_Title = 'Title';
const MODEL_Window = 'Window';
/*
* Protected properties
*/
protected $tagName = 'style3d';
protected $styleId = null;
protected $model = self::MODEL_Box;
protected $thickness = null;
protected $color = null;
protected $focusColor = null;
protected $lightColor = null;
protected $focusLightColor = null;
protected $yOffset = null;
protected $focusYOffset = null;
protected $zOffset = null;
protected $focusZOffset = null;
/**
* Create a new Style3d object
*
* @param string $styleId (optional) Style id
* @return static
*/
public static function create($styleId = null) {
return new static($styleId);
}
/**
* Construct a new Style3d object
*
* @param string $styleId (optional) Style id
*/
public function __construct($styleId = null) {
if ($styleId !== null) {
$this->setId($styleId);
}
}
/**
* Set style id
*
* @param string $styleId Style id
* @return static
*/
public function setId($styleId) {
$this->styleId = (string)$styleId;
return $this;
}
/**
* Check for id and assign one if necessary
*
* @return static
*/
public function checkId() {
if (!$this->styleId) {
$this->setId(new UniqueID());
}
return $this;
}
/**
* Get style id
*
* @return string
*/
public function getId() {
return $this->styleId;
}
/**
* Set model
*
* @param string $model Style model
* @return static
*/
public function setModel($model) {
$this->model = (string)$model;
return $this;
}
/**
* Set thickness
*
* @param float $thickness Style thickness
* @return static
*/
public function setThickness($thickness) {
$this->thickness = (float)$thickness;
return $this;
}
/**
* Set color
*
* @param string $color Style color
* @return static
*/
public function setColor($color) {
$this->color = (string)$color;
return $this;
}
/**
* Set focus color
*
* @param string $focusColor Style focus color
* @return static
*/
public function setFocusColor($focusColor) {
$this->focusColor = (string)$focusColor;
return $this;
}
/**
* Set light color
*
* @param string $lightColor Light color
* @return static
*/
public function setLightColor($lightColor) {
$this->lightColor = (string)$lightColor;
return $this;
}
/**
* Set focus light color
*
* @param string $focusLightColor Focus light color
* @return static
*/
public function setFocusLightColor($focusLightColor) {
$this->focusLightColor = (string)$focusLightColor;
return $this;
}
/**
* Set Y-offset
*
* @param float $yOffset Y-offset
* @return static
*/
public function setYOffset($yOffset) {
$this->yOffset = (float)$yOffset;
return $this;
}
/**
* Set focus Y-offset
*
* @param float $focusYOffset Focus Y-offset
* @return static
*/
public function setFocusYOffset($focusYOffset) {
$this->focusYOffset = (float)$focusYOffset;
return $this;
}
/**
* Set Z-offset
*
* @param float $zOffset Z-offset
* @return static
*/
public function setZOffset($zOffset) {
$this->zOffset = (float)$zOffset;
return $this;
}
/**
* Set focus Z-offset
*
* @param float $focusZOffset Focus Z-offset
* @return static
*/
public function setFocusZOffset($focusZOffset) {
$this->focusZOffset = (float)$focusZOffset;
return $this;
}
/**
* Render the Style3d XML element
*
* @param \DOMDocument $domDocument DOMDocument for which the Style3d XML element should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument) {
$style3dXml = $domDocument->createElement($this->tagName);
$this->checkId();
if ($this->styleId) {
$style3dXml->setAttribute('id', $this->styleId);
}
if ($this->model) {
$style3dXml->setAttribute('model', $this->model);
}
if ($this->thickness) {
$style3dXml->setAttribute('thickness', $this->thickness);
}
if ($this->color) {
$style3dXml->setAttribute('color', $this->color);
}
if ($this->focusColor) {
$style3dXml->setAttribute('fcolor', $this->focusColor);
}
if ($this->lightColor) {
$style3dXml->setAttribute('lightcolor', $this->lightColor);
}
if ($this->focusLightColor) {
$style3dXml->setAttribute('flightcolor', $this->focusLightColor);
}
if ($this->yOffset) {
$style3dXml->setAttribute('yoffset', $this->yOffset);
}
if ($this->focusYOffset) {
$style3dXml->setAttribute('fyoffset', $this->focusYOffset);
}
if ($this->zOffset) {
$style3dXml->setAttribute('zoffset', $this->zOffset);
}
if ($this->focusZOffset) {
$style3dXml->setAttribute('fzoffset', $this->focusZOffset);
}
return $style3dXml;
}
}

View File

@ -0,0 +1,100 @@
<?php
namespace FML\Stylesheet;
/**
* Class representing a ManiaLink Stylesheet
*
* @author steeffeen <mail@steeffeen.com>
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class Stylesheet {
/*
* Protected properties
*/
protected $tagName = 'stylesheet';
/** @var Style3d[] $styles3d */
protected $styles3d = array();
/** @var Mood $mood */
protected $mood = null;
/**
* Create a new Stylesheet object
*
* @return static
*/
public static function create() {
return new static();
}
/**
* Add a new Style3d
*
* @param Style3d $style3d Style3d object
* @return static
*/
public function addStyle3d(Style3d $style3d) {
if (!in_array($style3d, $this->styles3d, true)) {
array_push($this->styles3d, $style3d);
}
return $this;
}
/**
* Remove all Style3ds
*
* @return static
*/
public function removeStyles() {
$this->styles3d = array();
return $this;
}
/**
* Set the Mood object of the Stylesheet
*
* @param Mood $mood Mood object
* @return static
*/
public function setMood(Mood $mood) {
$this->mood = $mood;
return $this;
}
/**
* Get the Mood object
*
* @param bool $createIfEmpty (optional) Whether the Mood object should be created if it's not set
* @return \FML\Stylesheet\Mood
*/
public function getMood($createIfEmpty = true) {
if (!$this->mood && $createIfEmpty) {
$this->setMood(new Mood());
}
return $this->mood;
}
/**
* Render the Stylesheet XML element
*
* @param \DOMDocument $domDocument DOMDocument for which the Stylesheet XML element should be rendered
* @return \DOMElement
*/
public function render(\DOMDocument $domDocument) {
$stylesheetXml = $domDocument->createElement($this->tagName);
if ($this->styles3d) {
$stylesXml = $domDocument->createElement('frame3dstyles');
$stylesheetXml->appendChild($stylesXml);
foreach ($this->styles3d as $style3d) {
$style3dXml = $style3d->render($domDocument);
$stylesXml->appendChild($style3dXml);
}
}
if ($this->mood) {
$moodXml = $this->mood->render($domDocument);
$stylesheetXml->appendChild($moodXml);
}
return $stylesheetXml;
}
}