2014-01-12 00:51:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FML\ManiaCode;
|
|
|
|
|
|
|
|
/**
|
2014-06-21 03:18:21 +02:00
|
|
|
* ManiaCode Element for going to a link
|
2014-01-12 00:51:46 +01:00
|
|
|
*
|
2014-06-21 03:18:21 +02:00
|
|
|
* @author steeffeen
|
2014-04-13 18:21:40 +02:00
|
|
|
* @copyright FancyManiaLinks Copyright © 2014 Steffen Schröder
|
2014-06-21 03:18:21 +02:00
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
2014-01-12 00:51:46 +01:00
|
|
|
*/
|
2014-07-03 22:34:47 +02:00
|
|
|
class Go_To extends Element {
|
2014-01-21 20:30:40 +01:00
|
|
|
/*
|
2014-06-21 03:18:21 +02:00
|
|
|
* Protected properties
|
2014-01-12 00:51:46 +01:00
|
|
|
*/
|
|
|
|
protected $tagName = 'goto';
|
2014-06-21 03:18:21 +02:00
|
|
|
protected $link = null;
|
2014-01-12 00:51:46 +01:00
|
|
|
|
2014-01-19 19:30:21 +01:00
|
|
|
/**
|
2014-06-21 03:18:21 +02:00
|
|
|
* Create a new Go_To object
|
2014-01-19 19:30:21 +01:00
|
|
|
*
|
2014-06-21 03:18:21 +02:00
|
|
|
* @param string $link (optional) Goto link
|
2014-07-03 22:34:47 +02:00
|
|
|
* @return static
|
2014-01-19 19:30:21 +01:00
|
|
|
*/
|
|
|
|
public static function create($link = null) {
|
2014-06-21 03:18:21 +02:00
|
|
|
return new static($link);
|
2014-01-19 19:30:21 +01:00
|
|
|
}
|
|
|
|
|
2014-01-12 00:51:46 +01:00
|
|
|
/**
|
2014-06-21 03:18:21 +02:00
|
|
|
* Construct a new Go_To object
|
2014-01-12 00:51:46 +01:00
|
|
|
*
|
2014-06-21 03:18:21 +02:00
|
|
|
* @param string $link (optional) Goto link
|
2014-01-12 00:51:46 +01:00
|
|
|
*/
|
|
|
|
public function __construct($link = null) {
|
2014-06-21 03:18:21 +02:00
|
|
|
if (!is_null($link)) {
|
2014-01-12 00:51:46 +01:00
|
|
|
$this->setLink($link);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-06-21 03:18:21 +02:00
|
|
|
* Set link
|
2014-01-12 00:51:46 +01:00
|
|
|
*
|
2014-06-21 03:18:21 +02:00
|
|
|
* @param string $link Goto link
|
2014-07-03 22:34:47 +02:00
|
|
|
* @return static
|
2014-01-12 00:51:46 +01:00
|
|
|
*/
|
|
|
|
public function setLink($link) {
|
2014-06-21 03:18:21 +02:00
|
|
|
$this->link = (string)$link;
|
2014-01-12 00:51:46 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see \FML\ManiaCode\Element::render()
|
|
|
|
*/
|
|
|
|
public function render(\DOMDocument $domDocument) {
|
2014-07-03 22:34:47 +02:00
|
|
|
$xmlElement = parent::render($domDocument);
|
2014-01-12 00:51:46 +01:00
|
|
|
$linkElement = $domDocument->createElement('link', $this->link);
|
|
|
|
$xmlElement->appendChild($linkElement);
|
|
|
|
return $xmlElement;
|
|
|
|
}
|
|
|
|
}
|