TrackManiaControl/application/core/FML/Elements/SimpleScript.php

41 lines
788 B
PHP
Raw Normal View History

<?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
*
* @author steeffeen
*/
class SimpleScript implements Renderable {
/**
2013-12-31 02:55:19 +01:00
* Protected Properties
*/
protected $tagName = 'script';
protected $text = '';
/**
2013-12-31 02:55:19 +01:00
* Set Script Text
*
2014-01-12 00:51:46 +01:00
* @param string $text The Complete Script Text
* @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);
$scriptComment = $domDocument->createComment($this->text);
2014-01-12 00:51:46 +01:00
$xmlElement->appendChild($scriptComment);
return $xmlElement;
}
}