2013-11-25 00:02:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FML\Elements;
|
|
|
|
|
|
|
|
use FML\Types\Renderable;
|
|
|
|
|
|
|
|
/**
|
2014-01-12 00:51:46 +01:00
|
|
|
* Class representing a ManiaLink Script Tag with a simple Script Text
|
2013-11-25 00:02:07 +01:00
|
|
|
*
|
|
|
|
* @author steeffeen
|
|
|
|
*/
|
|
|
|
class SimpleScript implements Renderable {
|
|
|
|
/**
|
2013-12-31 02:55:19 +01:00
|
|
|
* Protected Properties
|
2013-11-25 00:02:07 +01:00
|
|
|
*/
|
|
|
|
protected $tagName = 'script';
|
|
|
|
protected $text = '';
|
|
|
|
|
|
|
|
/**
|
2013-12-31 02:55:19 +01:00
|
|
|
* Set Script Text
|
2013-11-25 00:02:07 +01:00
|
|
|
*
|
2014-01-12 00:51:46 +01:00
|
|
|
* @param string $text The Complete Script Text
|
2013-11-25 00:02:07 +01:00
|
|
|
* @return \FML\Script\Script
|
|
|
|
*/
|
|
|
|
public function setText($text) {
|
|
|
|
$this->text = $text;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see \FML\Types\Renderable::render()
|
|
|
|
*/
|
|
|
|
public function render(\DOMDocument $domDocument) {
|
2014-01-12 00:51:46 +01:00
|
|
|
$xmlElement = $domDocument->createElement($this->tagName);
|
2013-11-25 00:02:07 +01:00
|
|
|
$scriptComment = $domDocument->createComment($this->text);
|
2014-01-12 00:51:46 +01:00
|
|
|
$xmlElement->appendChild($scriptComment);
|
|
|
|
return $xmlElement;
|
2013-11-25 00:02:07 +01:00
|
|
|
}
|
|
|
|
}
|